How does a sailing boat work?

The standard idea is that the wind pushes the sails from behind, causing the boat to move forward. Although this technique is used at times, it is not the most efficient way to sail a boat (and it means the boat can never go faster than the wind). So what is the best direction for a sailing boat to sail? This video takes a look.