When the dinosaurs died out, the mammals had a field day. Released from dinosaurian thrall, they could occupy environmental niches that, only a few million years before, would merely have presented a dinosaur with an easy meal. It seems likely that the current diversity of mammals has a lot to do with the suddenness with which they came into their kingdom, for a while, almost any lifestyle was good enough to make a living. However, it would be wrong to imagine that the mammals came into existence to fill the gaps left by the vanished dinosaurs. Mammals had coexisted with dinosaurs for at least 150 million years.
Harry Jerison has suggested that before the dinosaurs became really dominant, many mammals were able to make their living in daylight, and they evolved good eyesight to do so. As the dinosaurs became a bigger and bigger problem, the mammals adopted a lower profile, mostly staying hidden undergound during the day. If you're a nocturnal animal, you rely on a really good sense of hearing, so evolutionary pressures then equipped the mammals with excellent ears, including those three little bones. However, they retained their eyesight. So when the mammals again dared to venture out into the daylight, they had good eyesight and good hearing. The combination gave them a substantial advantage over most remaining competitors.
Mammals evolved from an order of Triassic reptiles known as therapsids, small, quick-moving hunters, mostly, though some were herbivores. Compared to other reptiles, the therapsids were not especially impressive, but their low-profile lifestyle led, in stages, to the distinctive features of mammals. A diaphragm leads to more efficient breathing, useful if you need to run fast. It also lets the young animals continue to breathe while mother is feeding them her milk, changes to animals 'co-evolve' as a whole suite of cooperative attributes, not one at a time. Hair keeps you warm, and the warmer you are, the faster all your bodily parts can move ... and so on.
All this makes it difficult to decide when the mammal-like reptilian ancestors of the therapsids became reptile-like mammals ... but, as we've said, humans have problems with becomings. There was no such point: instead, there was a mostly gradual, but occasionally bumpy, transition. The earliest fossils that can definitely be identified as mammals come from 210 million years ago, creatures rejoicing in the name 'morganucodontids'. These were shrews, probably nocturnal, probably insect-eaters, probably egg-layers. Darwin's detractors objected to having apes as their ancestors: heaven knows what they would have thought about bug-eating egg-laying shrews. But there's good news too, if you're of that turn of mind, because morganucodontids were brainy. Not especially brainy for a shrew, but brainy compared to the reptiles from which they evolved. Admittedly, this was largely because the therapsids were as thick as two short ... er, slices of tree-fern, but it was a start.
How do we know that these early shrews were true mammals? One of the bits of an animal that survives as a fossil far more often than any other bit is the tooth. This is why palaeontologists use teeth, above all else, to identify species of long-dead animals. There are plenty of species for which the sole evidence is a tooth or two. Fortunately, you can tell a lot about an animal by its teeth. On the whole, the bigger the tooth is, the bigger the animal, an elephant's tooth today is a lot bigger than an entire mouse, so whatever animal it came from, it couldn't be mouse-sized. If you can find a jawbone, a whole array of teeth, all the better. The shape of a tooth tells us a lot about what the animal ate, grinding teeth are for plants, slicing teeth are for meat. The arrangement of teeth in a jawbone tells us a lot more. The morganucodontids made a major breakthrough in tooth design: teeth that interlocked when the jaws were brought together, very effective at cutting bits off meat or insects. They also paid a heavy price for their teeth, one that we still pay today. Reptiles continually produce new teeth: as old ones wear down, they get replaced. We produce just two set of teeth: milk teeth as children and the real thing as adults. When our adult teeth wear out, the only replacements available are artificial. Blame the morganucodontids for this: if you want to take advantage of precisely interlocking teeth, you have to maintain that precision, which is impractical if you keep discarding teeth and growing new ones. So they grew only two sets of teeth, and we have to do likewise.
From this we can deduce more. With only two sets of teeth, the morganucodontids had to have some special trick for feeding their young, something different from the reptiles with their continuous succession of teeth. There isn't room for a full set of adult teeth in a baby shrew, and if teeth only come in two stages, you can't add the odd one every so often as the jaw grows bigger. The easy solution is to have babies with no teeth at all, to start with. But what can they then eat? Something nutritious and easily digested, milk. So we think that milk-production evolved before those high-precision interlocking teeth. This is one reason why the morganucodontids are definitely placed among the mammals.
Amazing what you can learn from a few teeth.
As they prospered and diversified, mammals evolved into two main types: placental mammals, where the mother carries the young in her uterus, and marsupials, where she carries them in a pouch. The marsupial that springs most readily to mind is the kangaroo, possibly because it springs most readily to almost anything, as for example in The Last Continent:
'And ... what's kangaroo for "You are needed for a quest of the utmost importance"?' said Rincewind, with guileful innocence.
'You know, it's funny you should ask that...'
The sandals barely moved. Rincewind rose from them like a man leaving the starting blocks, and when he landed his feet were already making running movements in the air.
After a while the kangaroo came alongside and accompanied him in a series of easy bounds.
'Why are you running away without even listening to what I have to say?'
I've had long experience of being me,' panted Rincewind. 'I know what's going to happen. I'm going to be dragged into things that shouldn't concern me. And you're just a hallucination caused by rich food on an empty stomach, so don't try to stop me!'
'Stop you?' said the kangaroo. 'When you're heading in the right direction?'
Australia alone has over a hundred species of marsupials, in fact most native Australian mammals are marsupials. Another seventy or so are found in the same general region, Tasmania, New Guinea, Timor, Sulawesi, various smaller neighbouring islands. The rest are opossums and some diminutive ratlike creatures, mainly in South America, though ranging into Central America and for one species of opossum right up into Canada.
It looks as though placental mammals generally win out against marsupials, but the difference isn't so great, and if there aren't any competing placental mammals then marsupials do very well indeed. There are even some close parallels between marsupials and pla-centals, a good example is the koala 'bear', which isn't a true bear but looks like an unusually cuddly one.