A friend was asked to cut down several old lime trees in a local churchyard; they were old (250 years?). The centre of the trees had rotted away and looking down the centre of the felled trees the ends of thousands of old cut nail could be seen in each tree. They were from the base of the trees to about twenty feet high.
The trees (about six of them) all had the same thing. The nails were very old but for some reason the heads of the nails were just below the cambium layer.
No-one has been able to provide any reasoning ... the best suggestion has been that it was linked to pagan ritual. Hours of googling has come up without a thing.
Tress grow rings annually with the bark moving out- the nails stayed put. So with this info and if any of the centre of the tree remains- a guesstimate of date of placing the nails could be gauged. Iron supplement may be! or a local rituals such as celebrating a birth or some other family event.
"How does a nail get under the bark" The tree grows a new layer every year and slowly consumes the nail. I used to work in a sawmill and hitting things buried in the wood was a common occurrence. Usually it was nails,fence wire or occasionally bullets. One of the other sawmillers once hit a glass bottle, it reduced a 5 inch wide bandsaw blade to about 3 inches and sent shreds of steel flying across the mill.