Protective coatings for metals: how and what for are they created?

Protective coatings for metals: how and what for are they created?