We went to the Robertson screw factory in Montreal to see in detail how a reel of wire steel gets cut and formed into many different types of screws, including the famous Robertson square socket head.
They cut the wire to the length of two screws, often very different screws but the same wire size. They then form the rough head on one end, then punch in the socket, Robertson, Hex or even Phillips. Then they do the same to the other end of this little wire. The two screws are then cut apart and sorted into bins. These bins are dumped into threading machines that get the blank screws all lined up and in the right direction, then the screws, one at a time feed into a machine with two plates that have negative threads in them. These two plates clamp down on the blank screw and then slide one against the other and the thread is formed on the wire. From there, off to the plating shop. One screw at a time, day and night, almost non-stop. Fasteners can be fascinating.
Follow this link for some history on this Canadian invention.