Thunderstorms develop when the atmosphere is unstable - this is when warm air exists underneath much colder air. As the warm air rises it cools and condenses forming small droplets of water. If there is enough instability in the air, the updraft of warm air is rapid and the water vapour will quickly form a cumulonimbus cloud. Typically, these cumulonimbus clouds can form in under an hour.
As the warm air continues to rise, the water droplets combine to create larger droplets which freeze to form ice crystals. As result of circulating air in the clouds, water freezes on the surface of the droplet or crystal. Eventually the droplets become too heavy to be supported by the updraughts of air and they fall as hail.
As hail moves within the cloud it picks up a negative charge by rubbing against smaller positively charged ice crystals. A negative charge forms at the base of the cloud where the hail collects, while the lighter ice crystals remain near the top of the cloud and create a positive charge.
The negative charge is attracted to the Earth's surface and other clouds and objects and when the attraction becomes too strong, the positive and negative charges come together, or discharge, to balance the difference in a flash of lightning (sometimes known as a lightning strike or lightning bolt). The rapid expansion and heating of air caused by lightning produces the accompanying loud clap of thunder.
Thank you :)