Dear Fan,
Thank you for the compliments, I'm so glad you enjoy our grackle conversations! While I don't know exactly why your specific grackle friends are leaving nails and pieces of plastic, I can make an educated guess based on general grackle behavior.
Grackles (especially common grackles) have been observed dunking pieces of food in water, possibly to wash or soften them. So, it could be that your grackles are, as you mentioned, mistaking these objects for food and then realizing later they're not edible.
The collecting theory is an interesting one. While I don't know of any grackles exhibiting collecting behaviors, I do know of several other species of birds that collect non-food items. The satin bowerbird, which lives in Australia, collects objects to attract a mate. Bowerbirds have a special affinity for blue objects, and will spend much time seeking out blue flowers, feathers, pieces of plastic and glass to impress potential suitors. Crows have been documented bringing shiny objects such as coins and pieces of glass to humans who regularly feed them. You might wonder about magpies — billed in folk stories and anecdotally as avid collectors of shiny objects — but magpies were shown in a 2014 study to have no affinity for trinkets, and actually proved to be a bit scared of shiny, novel items.
Sorry I don't have a better answer for you, grackle fan. In this world so full of mysteries, thank you for being kind to birds!
Yours,
Grackle