When you get close to the pan, a tiny spark will light up between the pan and your fingertip. See if changing the number of strokes you rub changes the spark. That gave the foam extra electrons - what is called a negative electrical charge. That charge pushed away or repelled the electrons in the aluminum pie pan. When you reached toward the pan, those electrons formed a spark, and the negative charge moved from the pan back into the Earth, right through you.
Real lightning is many thousands of times stronger.
If lightning passed through you, it would probably kill you. Even though it's fabulous to watch, real lightning is very dangerous. Thunder can tell you how far away lightning is. When you see the flash of light, start counting slowly. Stop counting when you hear the thunder.