Thunderstorms form when moist air is heated by the sun, rises, and warms higher levels of the atmosphere. This part of the process is called convection. As the warm air encounters cold layers in the atmosphere, this water vapor cools, releases its heat, condenses, and forms a cloud. As the cloud grows bigger, it reaches the freezing areas of the atmosphere, and ice crystals form. When ice particles start to bounce against each other, they create electrical charges that eventually end up forming the lightning bolts you can see, which are followed by the sound waves of that event that you hear as thunder.
The progression of thunderstorms follows a 3-stage pattern. In the developing stage, the warm air is rising and a towering cumulus cloud starts to form. There is no rain, but sometimes you can begin to see lightning strikes. During the mature stage, heavy rain and sometimes hail starts to fall and creates a downdraft, pushing cooler air over the warm air, which creates strong gusty winds and sometimes tornadoes. You can also see the cloud flattening out at the top as it stops rising, which often takes the shape of an anvil. Finally, in the dissipating stage, the downdraft is so strong that it overcomes the updraft, and the warm air is dissipated by the cooler precipitation. Winds and gusts spread out wider, before the storm completely disappears.
Planes, especially commercial passenger jets, can safely fly through thunderstorms, but unless absolutely unavoidable, pilots navigate around them for the comfort and safety of passengers and crew. While the plane can withstand the strong winds, turbulence, hail, and even lightning strikes, turbulence can cause injuries when people are not seated or objects fall on their heads.
Visual observation, as well as advanced radar and flight instruments on board are very good at indicating the presence of thunderstorms, and pilots can adjust their flight path to avoid them. You might have experienced this on a flight, where you could see lightning in the distance and noticed how your plane was making turns to fly around towering clouds. Another option for pilots is to navigate to higher altitudes to fly above the storms.
Airports will not allow planes to take off or land during thunderstorms directly over the airport. Strong gusts, downdrafts, and heavy hail or rain is not safe for taking off or landing. Flight controllers will wait until the weather passes, so you can expect delays for departures and landings if thunderstorms are in the area. If areas of thunderstorms are persistent, incoming planes might be diverted to nearby airports where weather conditions are better. However, thunderstorms are limited in size and pass quickly, so controllers will often be able to wait out a series of storms and pick up normal operations quickly.