Touch the tip of your finger to the pie tin. DO NOT touch the Styrofoam tray. Touch the tin with the tip of your finger. It's all about free electrons trying to escape. Electrons are subatomic particles with a negative electrical charge.
Protons are subatomic particles with a positive electrical charge.
When you rub Styrofoam on your hair, you pull electrons off your hair and pile them up on the Styrofoam. When you put an aluminum pie tin on the Styrofoam, the electrons on the Styrofoam pull and push on the protons in the pie tin. When you touch the pie tin, those free electrons leap to your hand, making a spark. You are releasing some of the energy stored in the crystal structure of the candy. You'll see this energy in the form of tiny sparks.