Lightning forms when the electrons in the bottom of a cloud are attracted to the protons in the ground. When the attraction of these electrical charges is greater than the surrounding air's resistance to electrical flow, the electrons are able to stream down to the protons. At this point, lightning forms, heating the air around it and causing the air to expand. Thunder is then heard.
According to the PBS website, lightning contains a large amount of energy and heats up the surrounding air up to 54,000 degrees Fahrenheit. Since light travels at a rate of 186,000 miles per second, far faster than sound, people see lightning before they hear thunder.
NASA's SciJinks website notes that lightning often happens between or within clouds. Lightning can be seen from space. NASA's GOES-R Geostationary Lightning Mapper is designed to follow and study lightning that occurs all over the Western Hemisphere.
Lightning can also be dangerous, adds National Geographic. Every person has a 1-in-3,000 chance of being struck by lightning in his lifetime and a 1-in-700,000 chance of being struck in a single year. Lightning does not always occur during thunderstorms, as it can be seen during volcanic eruptions, heavy snowstorms and hurricanes.