Forging

The oldest technique for forming steel is heating it until it is red hot and then hammering it against an anvil. Obtaining the desired shape, however, is a highly skilled process and repeatability is difficult to achieve. By using specially shaped dies to create the desired form, forging has developed into an industrial process.
The tools are manufactured by casting or machining and a chunk (or billet) of the hot metal placed in the die and squeezed into the shape under enormous pressure. The process is used where high strength is required for objects such as crankshafts and spanners.

Cold Working

This is very similar to forging but, as the name implies, heat is not involved and it tends to be used to produce smaller components such as rivets, bolts and screws.
Threads, serrations, knurling and other grooves in metals is done by cold roll forming a process similar to rolling a piece of plasticine between your hands.
The heads for rivets, bolts and screws are formed by cold heading in which a punch, or for more complex shapes a series of punches, produce the required form.