You can make gains upwind by traveling up the most advantageous side of the beat. As you tack going up the beat you travel to the left- and the right-hand side of a straight line to the windward buoy. Very often the wind or the water flow on one side will be more advantageous than on the other.
A lay line is the imaginary line that extends down from the windward buoy depicting a windward course to it. Tack to get to the windward buoy as soon as possible. C travels further, tacks late and falls behind A and B.