Rats huddle together when it's cold. When it's warm, they separate. And when the temperature is moderate, rats in a group sort of cycle between the snug, toasty center of the huddle and the colder periphery.
Scientists at the University of Sheffield, in England, who've studied this behavior in rats describe the rodents as acting like a sort of "super organism." Kind of like a larger animal able to shape-shift to stay warm.
The ability to coordinate movements in this way is an evolutionary advantage. Even though each individual rat, or penguin, is acting out of self interest to stay warm, their actions end up benefiting the larger group by allowing it to regulate temperature.
Except that it's not entirely selfish individual behavior. The computer model the scientists used predicts that huddling only happens when individual rodents contribute some of their body heat for the good of the larger group. It's not a conscious decision, exactly, but rats and some other animals seem to have an intuitive understanding that sharing their warmth in self-organizing huddles is the only way to survive.