We had another today and unlike Wednesday's it rained.
All this heat around makes hot thermal spots and the cloud rises with it as a type of bonfire in the middle under it, and they just grow and grow and grow ...
Heat alone is not enough though. You also need an unstable atmosphere, and high dew points for Cumulonimbus to form and build. Thursday was nearly as hot as Wednesday, but no vertical development was observed because of lower humidity and a more stable air mass.
... and unless they're leaning over because of higher winds, the cold air falling through them as they get bigger puts the bonfire directly under, out = the death of an anvil-headed thunder cloud.
I love thunderstorms - proper weather! Those are the ones that leaned over long enough to reach the troposphere and spread out into that anvil formation.
The water in their higher reaches freezes, gets heavy and drops to warmer climes, melts a bit, sticks to it's neighbour and then rises up again on the thermals ...
up and down up and down they go, generating lots of static and a big positive charge in the cloud, as well as lots of hailstones that may fall as half pint raindrops, or hail.
The seperation of electrical charge in a cloud is complicated and still not fully understood. Friction and also the processes of water transformation play their parts. Water drops which break apart acquire a positive charge on the larger fragments, but a negative charge on the finer spray. Supercooled water droplets which freeze to rime acquire negative charge on the rime, and positive charge on any tiny ice splinters they shed in the process. There is a charge transfer between ice crystals of different temperatures and between ice crystals which rub together. All these processes, and probably others not yet discovered, contribute to the elecrification of a cloud. The cloud has an opposite charge from top to bottom (hence inter-cloud discharges [C-C]), and the bottom is charged opposite to the ground, hence lightning [C-G].
Most Cumulonimbus cloud tops do not reach right up to the Tropo
pause (not the Tropo
sphere), they are defined as Cumulonimbus clouds when the tops change from a hard defined structure to an icy, fibrous one. The fibrous top will spread as the freezing level caps the cloud's vertical development. It may spread out into an anvil top if the upper winds are strong enough, but not always.
Thunder is two things - the shockwave of the air getting out the way of the lightning (sonic boom!), and the crack! of the moisture in the air getting vapourised VERY fast.
Thunder is caused almost wholly by the rapid expansion of air around the lightning channel (the sonic boom as you call it). The flash you see is not the first one. There is an almost invisible leader stroke from cloud to ground, which ionises a narrow channel of air. The flash you see is the return stroke as the charge runs back up the ionised channel, from ground back into the cloud.