Nesting in a cavity—a hole in a tree, a burrow in a bank, or another enclosed space—gives a bird significant advantages. Cavity nests are generally safer than open-cup nests. The nest contents are concealed from predators (to some degree), although some predators can sniff out the nests anyway (think of snakes, monkeys, squirrels, marten and weasels, and so on). The cavity opening may be easier to defend than a wide-open cup. The eggs and chicks, and an incubating or brooding adult, get some protection from inclement weather, be it cold or hot or wet or whatever. For birds raising chicks in a nest (not applicable to ducks), nest-tending and food-delivery activities of the adults makes the nest a focus for observant predators; reducing the length of time needed for such activities reduces the risk of being observed and attacked. So open-cup nesters are in a hurry to get their chicks out of the nest, while cavity-nesting birds generally have longer incubation and nestling periods.
If you put a dot for every cavity-nesting bird species on the evolutionary tree, the dots would be scattered all over the many branches of the tree. Clearly, cavity-nesting has evolved many times, appearing in such disparate groups as ducks, falcons, woodpeckers, owls, puffins, petrels, chickadees, nuthatches, bluebirds, flycatchers, and others.
In many cases, these birds depend on finding an existing cavity, perhaps in a rotting or storm-damaged tree, perhaps in a rock crevice, or perhaps in a hole made by another animal such as a rabbit or a woodpecker. Interestingly, sometimes closely related species differ in their use of nesting cavities: for example, common mergansers nest in existing cavities but red-breasted mergansers (in the same genus) make open nests on the ground. Birds that are dependent on existing cavities often face intense competition for suitable, available spaces, which can be limited in supply. For example, there are many observations of European starlings displacing bluebirds or tree swallows from cavities. Likewise, tree swallows and chickadees sometimes contest ownership of a nice cavity.
There are two ways around that problem. One is for each bird to excavate its own cavity. The most familiar excavators (to most of us) would be woodpeckers. All of the birds we call woodpeckers excavate holes in trees or tall cacti, but some of their relatives in the southern hemisphere or the Old World do not.
Another excavator familiar to us is the belted kingfisher, which digs tunnels in earthen banks. There are many kinds of kingfishers; not all eat fish, but all are reported to excavate their nesting tunnels in earthen banks or termite mounds. A related group of many species, called bee-eaters, are also burrowers, often nesting colonially in earthen banks.
Other examples of excavators are found among the penguins, shearwaters, and petrels. The three species of puffin are usually dig burrows, the Atlantic and tufted puffins in soil and the horned puffin commonly in rocky places. All parrots make cavities for nesting, usually in trees, but one species stands out: the burrowing parakeet of Chile and Argentina regularly digs nesting burrows in limestone or sandstone cliffs. Three of the four species of North American nuthatches can excavate their tree nests from scratch, although all four more commonly use existing holes, modifying the cavity as needed. Our chickadees can excavate holes in soft rotten wood but often use existing holes.
The swallows, some of which are cavity nesters, provide an example of marked variation of nest type within one taxonomic group: Bank swallows (called sand martins in Europe) excavate tunnels in earthen banks, but rough-winged swallows generally depend on finding old holes in the banks. Tree swallows are not known to excavate but need cavities; cave swallows and barn swallows make open-cup nests. Cliff swallows, however, make covered nests of mud, stuck onto a vertical surface—which leads me to the second way of avoiding competition for nesting cavities:
Some birds aren’t cavity nesters (strictly speaking), but achieve some of the advantages of cavities by constructing a covered nest. The cover may be made in different ways, but it serves to conceal the nest-contents to some degree. Here are some examples: In Latin America, a large set of species typically constructs covered nests, often of clay; the resemblance to old-fashioned adobe bake-ovens earned them the sobriquet of ovenbirds. They are not, however, related to the North American ovenbird (a warbler), which builds a ground nest woven of plant material, with an entrance on the side. Marsh wrens and sedge wrens weave semi-globular nests of grasses and reeds; dippers, too, make bulky, more-or-less spherical nests of moss and plant parts, with a side entrance. Then there are the oropendulas and caciques of Latin America, the penduline tit of Europe, the orioles of North America, some weaver birds of Africa, among others, who weave bag-shaped nests, suspended from branches.
It would be wonderful if it were possible to unravel the genetic and ecological events that led to each evolutionary twig or branchlet with one or more cavity-nesting species, diverging from their open-cup relatives.