Lightning is a huge spark — a static electricity discharge on a grand scale. Static charge is built up by friction within the updraft region of a shower as ice crystals and water droplets bump around. Charge separation and lightning strikes can be within a cloud, from cloud to cloud, between the cloud and the ground, and even upward from the top of the cloud.
The reason some thunderstorms have very intense lightning is that there is a greater buildup of voltage (charge separation). This can result from a greater vertical temperature difference, a stronger updraft, or a very high concentration of water drops and ice crystals.
Sometimes in a thunderstorm, you will notice a sudden increase in rainfall shortly after a lightning strike. It is the heavy rain building up the charge that causes the lightning, but the lightning and thunder reaches your eyes and ears before the heavy rain.