There's a reason it's called sailing. And how it works is a physics lesson. (Actually, a lot of the technicalities behind how sailing works is a lot of physics. Back when I had to study physics, those were the easier topics for me: vectors, physics of fluids, pivots, because I could use sailing examples to understand them.)
The exact method how the sail propels the boat depends on the angle to the wind. The most simple way is going downwind (with the wind). The wind blows at the sail at somewhat 90 degrees, and the power moves the boat in that direction.
(The diagram is top view of the boat.)
Simple enough, right? But if that were the only way, we'd only be able to move in one direction. So at a different angle, we have what is called the Bernoulli effect ... the same method that keeps aeroplanes in the air. It looks like this:
Wind travels over both sides of the sail and has to meet up at the other end, so air on one side needs to move faster than air on the other side. This creates relatively lower pressure on the side where wind moves faster (the side with four arrows indicating longer distance to travel) and relatively higher pressure on the wind where wind moves slower (the part with three arrows indicating shorter distance to travel). The difference in pressure causes a force pushing diagonally (due to the uneven curve in the sail causing force to centre at the deepest part of the sail.
For those of you who aren't so fussed about how it works but want to skip straight to what it looks like, here be the pictures:
My boat has three sails: two are regular ones - mainsail and jib - and one is flown only at certain angles to the wind (spinnaker).
The mainsail is the big one, in the picture it has the letters and shapes on it. Those are for identification during racing: the national letters (yes, I know, my country unfortunately shortens to SIN), usually there are numbers, too, to differentiate between countries with multiple representatives. The blue 470 is the logo for the type of boat this is (a 470, in my case). And the red rhombus at the top marks this as a girl's boat.
This is the sail that is the main source of power (hence it's the biggest). One of my roles on the boat is to control it, to keep it reeled in (called 'sheeting') to the correct angle for where we want to point the boat as well as so that it's balanced for how much power we can handle depending on wind strength.
The jib is the small triangular sail at the front. On my boat this helps with fine-tuning our steering angles, channels the wind in a finer angle onto the mainsail.
From the back view:
The spinnaker is the red and white sail in the picture below - we raise it when we're moving off the wind. It can't fly when we're heading too close to the wind, but it gives us more power when we're moving away from it.