Static electricity occurs when there is an imbalance of positively and negatively charged atoms. Electrons then jump from atom to atom, releasing energy.
Lightening occurs as a result of a build up of electric charge in a cloud. It occurs when negative charges jump from a cloud to the ground.
The result of electrons moving from one place to another and cause a buildup of separated positive and negative charges creates a static charge.