Above, that's a Western Sandpiper shown poking his long beak into his tail area. The bird is beginning a period of preening by daubing his long beak onto his preen gland, or uropygial gland. The preen gland is a fleshy, small, oil producing, nipplelike nubbin typically at the base of a bird's back, about where shorter, fluffier back feathers yield to longer, stiffer tail feathers. During preening, birds smear oil from the gland onto their beaks or heads, then rub their beaks or heads over their bodies' feathers, oiling them up. The same sandpiper can be seen applying oil to his feathers below:
Preening accomplishes two main jobs. First, it returns feathers to their right places. If you've ever faced spending a cold night in a down sleeping bag that has "lost its loft," you know how dramatically you can increase the bag's insulation capacity by giving it a good shaking and a paddling. Well arranged feathers keep the cold out, crunched together ones don't.
Just as important, preening involves oiling the feathers. Like oil rubbed onto leather boots, preening oil keeps feathers flexible, resilient and somewhat waterproof. Also it inhibits the growth of fungi and bacteria.
The vast majority of birds have preen glands; emus, kiwis, ostriches, and bustards don't.