How does excretion (defection or urination) affect the thermal energy of the body? The substance retains some thermal energy from the body, but does losing that substance cool the body in any way?
Technically excretion does lower the total thermal energy of the body as it is leaving your body with the excretion, but it does not really in itself cool down the temperature of the body as the temperature is the same as your body (unless you define cooling down as negative change in the thermal energy needed to remove to lower object's temperature to zero K). Though if for example you drink cold water it does cool your body very slightly and urination could be thought of as dumping of used coolant.
Excretion does remove thermal energy from the body, but it also removes mass, and as a result your heat to mass ratio doesn't change in any meaningful way.
"Keeping it in" would technically make your body temperature slower to change (Up or down) because there is slightly more mass to heat or cool. Excreting would technically make your body temperature slightly more susceptible to change, again because there is less mass to heat or cool. But really, those changes are inconsequential.
The actual cooling would occur on intake, not excretion. When you drink cold water, your body heat will dissipate into that water until the temperatures match, resulting in a slight reduction in temperature.
So in summary, excretion itself does nothing to cool you down, even though it's taking thermal energy away, but the entire cycle of drinking cold water, heating it in the body, and then excreting it would reduce body temperature ever so slightly.
I'm not sure about number 2, but your bladder actually acts as a heat sink since piss is mostly water. Water has a crazy high heat capacity, so it drains heat from your body. It's a common tip for camping in extreme cold temperatures to not go to bed with a full bladder since your body has to spend some amount of calories warming up the piss.
I don't see how it makes a difference in the cold. It's already body temperature, so there would be a thermal equilibrium. Heat loss is a function of the body's surface area, which is unaffected.
The body is not a perfect thermal insulator so you must note that the liquid in the bladder is constantly losing heat due to dissipation into the surrounding tissues then the environment around the body. The greater the temperature differential between the body and the environment, the faster the rate of transfer.
Your body won’t (or at least it’ll try its damndest) to not let that internal temp drop, which will take more and more energy to maintain as the external temp drops.
When you say "cool the body" do you mean decrease the average temperature, decreasing the total thermal energy, or decreasing the total potential thermal energy? For the last two options the answer is a pretty clear yes because, even though our bodies try to efficiently consume food, poop still does have a bunch of calories in it and none of our waste leaves the body at 0K.
What about relative energy (energy per mass) - if poop is less energy dense than the protein/fat of your tissues, excreting it should increase your energy density
I don't have an exact answer for you, but I can share this: Part of military training up here in the Arctic involves a lot of cold weather training. And an officer explicitly told us that if we felt the slightest urge to shit or piss, take care of it ASAP - "Heating up all that crap is energy better spent heating up the rest of you"
Additionally if you can collect it and position it next to your skin somehow you can extract some of the heat back to your body. Gotta be careful though, lest you get piss or shit on yourself.
Im sure long-distance runners might relieve themselves without stopping, as it cools them down while also a release and embarrassment which might spur their brain into flight response.
I doubt if the heat loss is significant but when actively working out or doing intense work the mind might get tricked into thinking that it benefitted.
Anecdotally when running a fever it does feel better emptying out. So not sure if physiological or psychological effect.
The heat capacity of the human body is around 3.0kJ/kg°C, and the one of urine is likely close to water (4.2kJ/kg°C). As such when urinating a person loses proportionally way heat than mass.
So if you're feeling hot perhaps relieving yourself might give you a bit more comfort. Although you'll likely do it anyway, as you drink more water.