What is the energy balance of cooking?
If I cook some food, I get apparently several energetic advantages...


Let's make things a little more explicit. If you are talking of energy within the body, you are talking proteins, alcohols, fats, and sugars. You are not talking Vitamins or Minerals or any of the unique compounds (like specific antioxidants) that are available in the food.


  thermal : the temperature of the food is closer or superior to the temperature of my body or internal organs, so I do not have to produce energy to warm it.


You cannot eat enough to significantly alter the temperature of your body. The average American will eat roughly 5.4lbs of food per day - or roughly 2lbs of food per meal. Given that even raw food is at room temperature, the metabolic requirements to warm food you've eaten is negligible.

What's important is acidity and exposure. Food is generally broken apart and utilized by catalysts and proteins which have specific operating boundaries - which is why your stomach contents is acidic. However, your normal meals will not significantly alter your digestive capabilities either via pKa values or thermoregulation requirements.

What cooking can do is denature the raw food's proteins or compounds so as to make the usable energy sources more readily available. However, it can also just as easily destroy them (the 'char' on barbequed steaks is the meat exposed to high heat long enough to destroy almost everything but the carbon in the tissue). Whether a food gains or loses macronutrients depends upon the specific food and its preparation. A good example is potatoes, which are full of starch (sugars) in their natural state. However, french fries / frites / chips are often blanched before they're fried. The blanching dissolves much of the starch into water, leaving fewer sugars in the end product. However, the process of frying essentially adds fat to the food, and fats have a higher energy density than sugars so you have a net gain in caloric content.


  mechanical : the food may become easier to chew, absorb, conduct in the digestive tract, leading to less muscular force used.


For some foods, this is true. Steaming vegetables often makes them easier to chew/eat. The broth of stews and soups often contains micelles of fat and dissolved sugars, affording them greater and faster exposure to the digestive system. Keep in mind, you are not getting a net gain of caloric content from food by doing so, but merely reducing the time to utilization.

The calories saved by chewing less is going to be pathetically small, so to amend the previous paragraph: Yes, for some foods it's true that cooking will allow easier mastication and thus save energy. However, an extra chocolate chip or sip of spoon of rice could easily cover the energy spared. 


  The cooking procedure may involve water immersion, and the water may penetrate the food and improve all three energetic aspects outline above.


If the energy source is water-soluble (that is: alcohols, ketones, and sugars) then water immersion - assuming you are also digesting the water solution after - will offer faster utilization, not necessarily more.


  But what are the respective scale of these advantages, compared to the Joule intake of the raw food? 


Negligible in almost all cases. What cooking does is make things more palatable, has the potential to make micronutrients/vitamins more available (not macronutrients), and make the food edible in the first place as is the case with Taro plants, whose roots must be cooked in order to eat.


  Focusing on meat, for instance, is there an optimal cooking duration/temperature and eating temperature for human eaters, independently of personal tastes, for say, beef or chicken meat?


No. Cooking meat makes it safer to eat (unless you end up overcooking the meat and end up with a bunch of charred bone) and more palatable. Properly cooked meat has a very low chance of passing on parasites or other harmful organisms. Beyond that, there aren't compelling reasons to expose meat to heat - although as someone who's picked up stomach flus in his travels, it is a very compelling reason to do so.

*The above is based mostly on sporadically gained knowledge. If there are studies indicating otherwise, please alert me to them and I will rectify my errors.