Rust occurs when oxygen and water cause a chemical reaction to form iron oxides which are orange and crumbly. This is also known as corrosion.
iron + oxygen + water → hydrated iron(III) oxide
4 FE (s) + 3O2 (g) + 2H2O → 2FE2O3 * H2O
The reaction between iron and oxygen to form iron oxide is an called an oxidation reaction. The oxygen steals electrons from the iron causing it to become oxidised. The water (electrolyte) helps speed this process up by accelerating the flow of electrons from the iron to the oxygen. In fact, iron reacts so readily with oxygen its very rarely found in its pure form in nature.
Did you know reddish colour of iron oxides are also responsible for why Australia is seen as red from space -iron oxides are present in the soil and rocks- and similarly why Mars is dubbed the red planet.
Rusting can be a big problem for engineering as can make structures breakdown. Rusting can be prevented by creating a physical barrier to oxygen and water. Ways to do this include painting, oiling, and greasing or coating with plastic.
Only iron, or alloys containing iron such as steel, can form rust but many other metals can undergo similar corrosion processes. Copper is naturally brown but turns a shade of bright green when oxygen causes corrosion to form copper oxides or “Patina”. This is why lots of copper roofs and statues are now green. Did you know the statue of liberty used to be brown, but corrosion has turned the copper green!