The ear is a wonderful and complex organ. The linked page includes a diagram of the human ear and a video explaining how it works, as well as explanatory text. One part essential to the ear’s function is the eardrum, a membrane that vibrates in response to sound waves.
Normal vibration of the eardrum requires that there be air on both sides. If you have ever had an infection in which liquid accumulated inside the eardrum, you may remember how your hearing was affected.
Air is a gas, and a property of all gases is pressure. Pressure is defined as the force per unit area of a surface—in this case, the eardrum. Pressure is caused by the collisions of the particles of the gas with the surface. Individually, these collisions are too small to detect, but collectively they exert a force.
Most of the time, the pressure of the air on both sides of the eardrum is the same, but sometimes the external pressure may be lower or higher than the internal pressure. The gas on the side with greater pressure pushes harder on the eardrum, causing it to bulge away toward the low-pressure side.
A bulging eardrum affects hearing and is uncomfortable, so we have a mechanism to correct it. The Eustachian tube, shown in the diagram at the link, connects to the throat, and when we swallow, it adjusts the air pressure inside the ear to match that outside.
I’m not sure if the “pop” you’re referring to is the uncomfortable sensation of a pressure imbalance, or the sudden relief that occurs when you swallow (or chew gum), but both accompany a pressure imbalance.
As you may know, the pressure of atmospheric air decreases as altitude increases—for example, as you go up a mountain. This is because as altitude increases, there is less weight of air above pressing down and causing pressure. Atmospheric pressure is caused by the weight of the air above, pressing down.
So at the top of a mountain, the atmospheric pressure is less than it is at lower altitude. People who have just climbed, or driven up, the mountain may have higher pressure inside their ears, since they were recently down below. Thus they are likely to experience the discomfort and sudden resolution I described above.