How does sunscreen work?

What is SPF and can I still tan with it on? All your questions answered!