The process of sweating food means exactly what you think it means – making them release water. Almost all cooking methods involve releasing water from food, but when you’re given the instruction to sweat something in a recipe, it generally means that you need to keep the released water from evaporating to a certain extent.
For example, when sweating onions or mushrooms, you need to put a lid over the pan in which you are frying them in order to trap the condensation. This means the water doesn’t evaporate, they don’t dry out, and they end up cooking in their own expelled water. As long as you have them on a low heat, they can go on stewing in their own juices for quite a while, intensifying their flavour.
A good guideline as to when onions or other ingredients have been sweated properly is when they’re soft and floppy but not swimming in their own juices. If a massive amount of water is released during the cooking and doesn’t look like it’s going anywhere, just take the lid off and let it evaporate, stirring often. It’s not ideal, and if your ingredient is letting out loads of water, you may want to investigate why it’s got such a high water content.
For example, when you fry cheap bacon, you get loads of watery rubbish released from the meat because it’s bulked out with saline solution. But good bacon releases hardly any water, because it’s mostly meat and fat. It’s worth looking out for.