Usually the cause is the nail falling in a crack such as sheathing joints or probably in your case cracks between the rake trim and roof if you have old t locks that were face nailed to hold the ends down they always work out it would be easy to peel a shingle back on the edge to see if this is the problem.
Nails backing out of roof.
Nothing keeps hand nails from backing out.
Gun nails have a couple ridges in them from the wire collation.
If it is just in the area of the the spar you showed us then it might be further evidence of past damage.
This leaves small holes that water can easily penetrate and leave your shingles unstable.
That keeps the gun nails from backing out of the wood.
Joined sep 17 2008.
Such little holes are typically unnoticeable to an untrained eye however a good roofing inspector is trained to see the signs of nails backing out.
Also is that the only place you have an issue with nails backing out or are they backing out all over.
It is vitally important that roofing nails of the correct length were used to secure the shingles.
Apart from roofing shingles roofing nails can sometimes back out.
There are all sorts of reasons why nails back out of seemingly solid wood but perhaps the most common reason is that the nail did not get a good bite into the wood when it was first driven.
If you have a friend in the attic ask him to direct you to a sturdy spot where the nail can bite into the wood.
Dan thomas well known member.
Hammer a new nail into the roof about 1 inch above the hole from the previous nail.
A gun nailed roof properly installed is a better roof than a hand nailed roof.