Rust is the result of a conversion process that takes place when oxygen and moisture come in contact with metal. The oxygen and water combine with iron to create a brown coating (hydrated ferric oxide) on the surface of the metal.
The interaction between the water and iron is accelerated if salts are added to the mix. Because the oxide that is created is bulky and porous, it allows oxygen access to the iron below, causing additional oxidation. If allowed to continue, the iron metal will be completely converted to ferric oxide or solid rust, which is weak and flaky.
Stopping metal from rusting
This chemical process can be stopped if water and moisture are not allowed to contact the metal surface. Typically, metal is coated with some substance to seal it off from oxygen and water. These coatings can be as simple as oil and grease Industrial Paint or chemically complex primers and paint. Coatings are effective as long as the separation between the metal and oxygen and water is maintained.
If the oil or grease is wiped off or dries out, rust begins to form. In the case of paints, they begin to shrink and crack over time. When this happens, cracks develop in the coating, allowing rust to start. Even a deep scratch in a painted surface will expose the metal. Once the rust starts, it travels under the paint forcing the paint away from the metal, allowing more moisture and oxygen to come in contact with the metal surface.
Sealing the surface
Generally the only way to reseal the surface is to mechanically or chemically remove all the rust before the surface can be sealed again. If any rust remains, and paint is applied over the surface, enough moisture and oxygen will travel through the paint molecules to start the rusting process again. For this reason, most paints directions require you to remove all rust before you paint the surface.