What is two-factor authentication? Where should you use it?

Enabling two-factor authentication makes it significantly harder for an attacker to compromise your online accounts, but what is it and when should you use it?