The only time I have had nails work their way out of a roof deck (the wood the roof is nailed to) is when I used aluminum nails to secure down a ridge vent. It seems that aluminum has poor holding power.
I cannot think of why the standard galvanized roofing nail would pop out of the roof.....unless the last layer of roofing was the second (or even third) roofing layer and the roofing nails were the 1" (instead of 2") variety, meaning the shorter nails never made it to the roof deck. When you go into the attic, can you see the sharp ends of the roofing nails sticking through the roof deck? It is a bad sign if you cannot.