Thunder and lightning is, by definition, a key element required before any rain shower is classified as a thunderstorm. Lightning is really just a huge spark; a static electricity discharge on a grand scale.
Static charge is usually 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 such intense lightning is that there is a greater buildup of voltage (charge separation). This can result from there being a greater vertical temperature difference or a stronger updraft. Sometimes in a thunderstorm, you will notice a sudden increase in rainfall shortly after a lightning strike. It is the heavy rain which builds up the charge that causes the lightning, but the light and sound gets to you before the heavy rain does.