Temperature and carbon content factor into the creation of steel phases. Steel exists in the ferrite phase at room temperature. Austenite phase is achieved at a higher temperature. Austenite has a higher capacity for carbon than ferrite. Once cooled, austenite will turn into a mixture of ferrite and cementite at a steady rate.
Pearlite is a mix of ferrite and cementite, which is produced after a steady cooling rate. It is first rapidly cooled and then it is cooled afterward very slowly so bainite will develop. Martensite is steel that is cooled quickly.
Annealing soaks a metal and then steadily cools it to have better machinability, less hardness, and release stress. Normalizing cools metal much faster than annealing to make the characteristics between the surface and the interior different. Quenching cools the metal quickly to produce martensite, which is quite hard and brittle. Tempering soaks martensite at a lower temperature to recover ductility and toughness.
There are a wide variety of heat treatment steps to make steels with specific hardness values. A lot of metals have been surfaced hardened, which have a ductile interior and hardened exterior.