What is a payment processor and how does it work?

What is a payment processor and how does it work?