Thunder is caused by lightning. When a lightning bolt travels from the cloud to the ground it actually opens up a little hole in the air, called a channel. Once then light is gone the air collapses back in and creates a sound wave that we hear as thunder
Reason behind thunder formation
Thunder is the sound caused by lightning. Depending on the distance from and nature of the lightning, it can range from a sharp, loud crack to a long, low rumble (brontide). The sudden increase in pressure and temperature from lightning produces rapid expansion of the air surrounding and within a bolt of lightning
conditions for thunder occur in water rain
When the charges are strong enough, the electricity is discharged as a bolt of lightning while some lightning often precedes rain, the main event occurs as a downdraft starts and rain or other precipitation falls. Eventually, the downdraft overcomes the updraft and the storm dissipates, along with the lightning