Body heat is a vital condition that animals need to survive. It is so vital that when you are hypothermic, your body will override almost everything else to conserve heat as much as possible. Without enough heat, the chemical reactions that fuel your cells will grind to a halt and you will die. To solve the issue of getting heat, nature came up with two answers: endotherms and ectotherms.
Endotherms are organisms that produce their own heat (e.g. mammals) by trapping the heat produced by metabolism and through extra mechanisms such as shivering. Ectotherms rely on absorbing environmental heat (e.g. reptiles), usually through the sun. Because of this, ectotherms suffer a much greater range in body temperature. This means that animals such as lizards will be slower and more sluggish when it is cold.
Being in a cold environment quickens the process of heat loss, robbing you of the precious heat you generate. A solution to this is shared bodily warmth. Also known as kleptothermy, this is a common thermoregulation strategy where a group of animals huddle together to share the heat generated by each other. This increases the efficiency of heat generation (thermogenesis) and the group as a whole can stay warmer for longer. This behaviour is commonly seen in communal animals such as mice, who huddle together even when they are newborns (newborns lose heat much quicker than adults due to the difference in weight to surface area ratio). Some ectotherms such as snakes and lizards also engage in kleptothermy, where by huddling together they increase their effective mass and reduce heat loss.
An interesting case of kleptothermy is seen in Canadian red-sided garter snakes, where the heat is not shared, but stolen. A male snake will sometimes emerge from hibernation and begin to produce fake pheromones to attract other males as if it were a female. Other males are fooled into thinking that the snake is female and approach it to mate. Through this strange process, the snake is able to steal the heat from its rival males and use the extra energy to mate with an actual female (or lose it to an even more cunning male snake).