The reason why hot tea or coffee stays warm for so long in a thermos is the special design of the flask. This design limits the different mechanisms of heat transfer and thus reduces heat loss to a minimum.
The first and simplest measure to reduce heat loss, is aimed at the heat transfer by thermal convection. A simple screw cap prevents the hot steam from escaping and ensures that no heat is transferred by convection to the environment.
The second measure serves to limit thermal conduction through the flask. For this purpose, the thermos is often designed with a double wall. In the simplest case, there is air or another thermal insulation between the two walls.
Note that air works relatively well as thermal insulation for heat conduction due to its low particle density. In expensive thermos there is even a vacuum in the space between the two walls (therefore a thermos is also called vacuum flask). After all, without particles there is no heat transfer from particle to particle as is the case with thermal conduction.
Of course, the inner wall of the vacuum flask cannot be completely separated from the outer wall by a vacuum or other insulating material. After all, the two walls must be connected with each other in some way. However, this allows the heat-insulating effect at these joints to be bridged and heat to flow out of the flask. Such mostly unwanted bridging of the thermal insulation is therefore also called a thermal bridge (also referred to as cold bridge).
The third thermal insulation measure aims at preventing thermal radiation. For this purpose, the inside of the thermos is mirrored. Like visible radiation, heat radiation that is not visible to us is also governed by the laws of physics, especially the law of reflection. The heat radiation is permanently reflected by the mirror coating inside the thermos flask and remains, so to speak, trapped in the flask and thus hardly ever escapes to the outside.
Note: The principle of thermal insulation by using insulating material and reflective foil is also applied, for example, to hot water pipes in households.
Incidentally, the above-mentioned measures not only ensure that hot drinks stay warm for a long time, but also that cold drinks stay cool in summer. In this case, these measures ensure that as little heat as possible penetrates the flask. In order to limit thermal radiation effectively in this case as well, a thermos is usually additionally mirrored with a reflective coating on the outside! The typical metallic shine of the vacuum flask therefore has not only an optical reason but also a physical benefit.
How long a vacuum flask keeps a drink warm or cold is usually specified by the manufacturer. It is noticeable that thermos flasks usually keep cold drinks cold longer than hot drinks warm. This has to do with the difference in temperature between the drink and its surroundings. The temperature of a hot drink is usually a maximum of 100 °C. In winter with ambient temperatures of 0 °C, the temperature difference is thus 100 °C. This temperature difference is ultimately the driving force behind the heat flow. In this case it is thus relatively large and thus also the heat losses.
When keeping a drink cool, however, the temperature difference between the drink and its surroundings is much smaller. In the liquid state, the lowest possible temperature is 0 °C for water. In summer at ambient temperatures of 30 °C, the temperature difference between the beverage and its surroundings is therefore only 30 °C. At this temperature difference, the heat flow and thus the heat loss is significantly lower. For this reason, cold drinks stay cold longer than hot drinks stay warm.