What is the role of payroll and How can I do payroll on my own?
I have done payroll for a very long time for some pretty big companies, one of which you have probably heard off. It generally took my 3 years to fully train in a payroll staffer. The starting point is The Payroll Source Book, by the American Payroll Association. This is generally referred to as "the payroll bible". It is mostly federal rules only. You also need the employer's tax guide for each state you are in. A 2-year degree with some accounting courses is also useful. The APA has local chapters in most large cities.
The role of payroll is to pay employees and comply with a huge number of federal, state and local regulations. Plus work with accounting and HR on a number of shared issues.
Regarding doing payroll on your own, do you mean having other people pay you to do their payroll? Like any other professions, potential clients will look at your credentials and track record. There are plenty of established payroll companies with verifiable track records. I generally used ADP, not because of their weak customer service skills, but because of their very strong record as an IT company who "makes the trains run on time". I already know more about payroll then anyone they (or anyone else) is likely to know and I do not not need my hand held. I do need them to do EXACTLY what I tell them to do, no excuses, for any reason. A single payroll error can cost more then the entire years payroll service so it is difficult to take seriously someone whose sole selling point is that they are 10% cheaper then the big guys.
Payroll collectively should be an error free environment. A big enough payroll error can put many companies out of business. Even small errors burn overtime to fix. My last two jobs, I took a newly vacant position because my predecessor dropped the ball.