Iron nails and other objects like horseshoes were used to ward off evil, because iron was long thought to be the enemy of the Devil and his demons.
Iron has long been the material weapons have been made out of, or a constituent part thereof. One of the daggers found in the tomb of Tutankhamun, had been forged from iron from an actual meteorite, what better weapon could you have against evil than one which fell from the heavens.
In the UK some medieval and later doors are decorated with iron studs, as well as forming decoration and giving strength, they also present evil forces with a barrier of iron, and hence are apotropaic.
In Ethiopia iron nails, studs and staples have not just been used on the doors for strength and to hold the different pieces together, but are in fact apotropaic.
Here is an example of a massive door to an Ethiopian Church with many iron staples protruding from its outer face.

Iron Staples to a Door at Mikael Imba Rock-Hewn Church, 8th Century AD, Tigray
Another door also has decorative iron studs holding a central muntin or strengthening rod, to the outer face of it, again to act as an iron barrier to demonic forces, as well as a geometric carved facade which will be dealt with on another page.

Iron Studs to a Door at Mikael Imba Rock-Hewn Church, 8th Century AD, Tigray
Another door to an Ethiopian Church also exhibits iron nail studs, and oddly they are arranged in three rows of exactly twelve studs (or to the middle row, in the past twelve, as some are missing, but their site may be verified as there are visible holes where they once sat).
This means that there were once 36 iron studs protruding from the door, in 3 sets of 12. From the numerology of these, we know that the Holy Trinity is represented by three, so the three rows may equate to this, and we also know that Christ had twelve main disciples. Thirty six on the other hand has many meanings, as well as forming a perfect sixfold square, symbolising perfection and true proportion, i.e. 6 times 6; it has many more religious and occult meanings. 36 times two also equates to 72, the supposed number of names of God, or the accepted number of major and minor disciples who followed Christ. It is also the angle in degrees between the points of a pentagram, as well as having many more sacred attributes.
So, therefore without a doubt we may conclude that these iron studs serve as a protective device against the evil which lurks in the outside world, as well as performing a function to the door and as decoration.

36 Iron Studs to a Door at Yimrahanna Kristos Cave Church, Early 11th Century AD, Lalibela
* * * * * * *