There's a fairly significant problem with the evolution of endothermy from ectothermy, a paradox that has no satisfactory conclusion as of yet: How could well-insulated animals with high metabolic rates producing lots of heat from within their bodies evolve from animals with low metabolic rates and poor insulation, expertly absorbing heat from the surrounding environment?
If these characteristics evolved independently what purpose would they serve? An ectotherm has no use for insulation like feathers or hair since heat exchange needs to be rapid with its surroundings, just as it has no use for a heat producing high metabolism without the necessary insulation.
Raymond Cowles' experiment showed that by putting little fur coats on lizards wasn't keeping heat in, it was keeping heat out. The lizards couldn't warm up.
That's the paradox, the catch-22. The ticket out, however, is the exaptation: An adaptation of a structure that becomes useful for one biological purpose that originally evolved for another.
Feathers are are thought to be derived from the long scales of ancient archosaurs. These reptiles could lift their scales and expose their skin directly to the source of heat, or orient them so that they could block heat absorption. Just as the marine iguanas of the Galapagos Islands are able to trap a layer of air within their scales, these reptiles are thought to have done the same, retaining more metabolic heat, leading to a more active life.
Another theory concentrates on our reptilian ancestors from the synapsid lineage. The synapsids were steadily becoming more active (illustrated by changes in bone structure), and those morphological changes could have been accompanied by higher metabolic rates, leading to more heat in the body. The more hair on the body, the better heat retention.
So which came first, the dino or the egg?
It's apparent that endothermy evolved at least twice; once beginning with an exaptational insulator in the case of birds, and once beginning with exaptational skeletal changes and a needed increase in activity for foraging, in the case of mammals.
Largely, however, the jury is still out. (I heard that there is also evidence that pterosaurs might have been endothermic, leading to a third origin of endothermy; please link research if you know of any.)
Its important to realize that there are in-between states of thermoregulation, and the progression from ectothermy to endothermy (and back again, in some cases) took place in baby steps across millennia. Time and again we're shown that organisms tend not to fit our definitions and molds. It's not like flipping a switch.
More on dinos and thermoregulation for part III.