I'm sure there are different techniques for different space suits, but here's an example of how it is done for the ISS suits:
The key to handling body heat and sweat is the Liquid Ventilation Garment, or LVC. This is essentially what looks like a full body thermal underwear, but it is lined with tubes that pass water through them. If you heat up, cold water is passed through the tubes, cooling you down. The idea is to keep you cool enough that you don't sweat much.
After the water is heated, it passes through a heat exchanger to cool it down again, then it's recirculated. If necessary, the water can be passed into a sublimator, where it passes though small holes into the vacuum of space, where it sublimates away, carrying heat with it.
If a person does still sweat, the LVC has a wicking layer that will absorb the sweat, and through some mechanism the sweat is collected and added back to the cooling water supply. The problem here is that as you work harder, the temperature of the water in the cooling tubes has to be lower to transport enough heat, which can make it feel cold. Add in a damp undergarment, and astronauts can feel very uncomfortable with this system. Also, you are losing a lot of water to space through the sublimator - maybe a kg of water for a four hour EVA. That's not only expensive, but it limits EVA time.
There is a new LVC being developed for the next gen of suits which will have porous micro-tubules stitched into it that can actually absorb the sweat, the transport it back to the cooling system for recycling. That will allow astronauts to use sweating as their natural heat control.
In the future, mechanical counterpressure suits that don't need to be pressurized will have semi-permeable materials that allow sweat to pass through and sublimate away all across the surface of the suit, which would allow for more passive cooling and a more natural feeling environment.
Link to a paper on the new generation of LVC garments being considered:
Multi-Functional Cooling Garment for Spacesuit Environmental Control
And a paper from 1969 describing the old system for cooling:
Regulation of Thermal Sweating in EVA Space Suits