
Static electricity can be induced by rubbing two insulators together. One material loses electrons to the other. The one losing electrons becomes positively charged. The other gains electrons to become negatively charged.
When these two charged surfaces are brought close enough together, a spark may jump, as electrons leap the gap to cancel out the charge imbalance. This can be experienced as an electric shock.
This applies to any charged surfaces where the imbalance in charge is large enough to make the electrons leap the gap. The spark can be dangerous. Near fuel vapor, as at a gas or petrol station, it can even cause an explosion.