Sonic Booms occur when an object travels faster than the speed of sound.
The speed of sound can vary depending on your height above sea level, it travels faster near sea level and slower the higher up you go, before i can explain how a sonic booms occurs i first have to explain the reason why the speed of sound changes depending on height above sea level.
If you imagine the atmosphere as containing gases of different densities all sitting on top of each other depending on their individual specific gravities so that the heaviest gases will be at sea level, the next heaviest above that and so on and so on, all the way up until there are essentially no gases left. This is the reason why helium balloons float, the helium is lighter than the sea level gases and as a result it floats upwards,it is similar to an air bubble that is trapped underwater.
So the layers of gases would look like this –
Next, you need to understand why sound travels faster through the lower gases than the higher ones. As we already now, the gases near sea level a more dense that the ones higher up in the atmosphere, this also means that they are more closely packed together. To understand this we can make an analogy with a race of Chinese Whispers with two groups, the first group will represent the gases higher up in the atmosphere and the second group will represent the sea level gases, the aim is to see which group can finish first. Both groups are given the same phrase to pass on to each other, the only difference is that group ones participants are 2 metres away from each other and must walk a short distance to the person next to them, group 2 are standing directly beside each other.
I think its pretty obvious which group will finish first. This is the same as the sea level gases –
If i were to make a noise at sea level the dense gases pass that shock wave on to each other faster than gases at higher level because they are closer to each other, this is the reason why the speed of sound changes depending on sea level – the less dense a gas is the more slowly it can transfer a shock/sound wave.
When any object moves through the atmosphere it creates a wave in front of it similar to the bow wave in front of a ship, the problem being that it is not visible until very high speeds are approached. A sonic boom occurs when these waves begin to bunch up on each other and can no longer escape the speed of the aircraft. Once the two of them reach the same speed a sonic boom is released, on very rare occasions these have been seen to smash windows.