Today we are told to drink so much water that our output is almost clear. But, this is only possible because fresh, clean water is readily available to us at any time. Even I notice I get dehydrated and fatigued easily if I don't drink more than one or two big glasses a day, even on days when I'm less active. Before the days of sanitation, I know that many people drank beer, even children, which probably only made dehydration worse. This is compounded with the fact that most people were generally much more physically active in their daily lives and wore many layers of clothing, even in hot months. How did they keep their energy levels up to do the constant work needed to survive in those days without those oversized sports bottles we have today?
Before the days of sanitation, I know that many people drank beer, even children, which probably only made dehydration worse.
This is actually a myth -- please see the "Drinking Water" section of our FAQ, and below it, "Beer."
There is an account floating around somewhere of just how many water carriers there were in Paris in the ~18th century. I am having an impossible time tracking it down amidst the stories, but IIRC this account of there being 20,000 water carriers in Paris in the early 19th century is actually a reduction from earlier counts, despite the city's growth.
Presumably the network of fountains mentioned were improving the situation.
Regarding the clothing, I think you're mistaking layers of clothing for keeping heat in, when that isn't always the case. Consider the extreme case of Bedouin nomads, who wear head-to-toe covering in the desert. Despite often wearing dark colors--even black--the Bedouin stay cooler because they have the clothes, in part because air can move around inside the loose clothing in a couple of ways.[1]
Loose clothing was common, in part because creating well-tailored, tight-fitted clothing was expensive. (It still is today: compare the cost of off-the-rack clothes that are "good enough" with a bespoke suit that can cost thousands of dollars.) Layered clothes can also allow air movement, improve moisture wicking, and generally lead to better cooling, which can reduce sweat levels. Comments in this post go into some more detail about different levels of clothing and how it often was not what we see in paintings.
You may also be overestimating the amount of work done by peasants. The days were often long and hard, but they weren't without meal breaks (and sometimes church breaks), and they generally weren't pushed to work to their deaths. (Employers that did this without paying very well couldn't expect many new prospective employees.) Layers of clothing could usually be removed (within reason) if it got warmer. Time was sometimes taken off (without pay, of course) to go to fairs and festivals, and there were often quieter months between planting and harvest, and sometimes in the winter. There's more detail here.
[1] Why do Bedouins wear black robes in hot deserts?, which also mentions that greater short-wave (that is, heat-carrying infrared) radiation gets through white pigeon feathers and cattle hair than through darker feathers and hair.