Sweat is the body's way of cooling off. The key to the effectiveness of sweating is evaporation. So the real question is, How does evaporation cool you down?
Sweat is mostly water, and molecules in water are in constant motion. The temperature of water gives us an idea of the average motion of the water molecules. Each water molecule bounces off its neighbors, sometimes gaining energy from the collision, and sometimes losing energy to other molecules. At any given time, however, some molecules carry more energy than others. That is, most molecules will have temperatures close to the average, but some will be much hotter or colder than the average on occasion.
When water evaporates, some of the molecules fly out of the liquid into the air. Hotter molecules have more energy and are moving around faster, which means that they are more likely to fly away and leave the cooler molecules behind. The evaporating molecules in your sweat actually carry the heat of your body into the air.