For birds, cleanliness is not optional. They rely on their feathers for flight and insulation, and only replace those feathers once or twice each year. In between molts, they need to keep their feathers as whole as possible.
Feathers, like our hair, are made of protein; and like all organic things, they degrade over time. Sunlight hastens this degradation, but certain aspects of the feathers themselves can slow it: dark feathers colored with melanin last longer in sunlight, for example. Of more concern, though, are the many creepy-crawly things that like to eat protein, and will happily hang out in a bird’s feathers, munching and laying eggs.
To combat these parasites, birds coat their feathers in protective oil from the preen gland located at the base of their tail, and they bathe.
But they have to be careful. Small wild birds are lunch for everything from feral cats to Cooper’s Hawks, and no bird wants one of these sneaking up on it while it is obliviously scrubbing behind its ears. So they bathe in bursts, a plunge into the water followed by a quick look around.