Proof of Work: what is it?

How does cryptocurrency mining work?