Marine birds or aquatic birds secrete a greasy oily substance that is mainly composed of quite unusual lipids. These birds have an organ called a preen gland also uropygial gland located at the back near the base of the tail that is responsible for the secretion of this substance.
The birds apply this oily substance over their feathers by rubbing their bill and head over the uropygial gland then rubbing off the accumulated oil quite thoroughly over the feathers of wings, back and every accessible part including the skin of their legs and feet.
This oil produces a waterproofing effect on the birds' feathers and thus they do not get wet but water simply runs off their surface.