According to livescience.com, cats have more vertebrae than humans, which enables them to move in ways that humans can't; their inner ear also provides a keen sense of balance. When a cat falls and experiences disorientation, they rotate their upper body to face downward, and their lower body follows suit to position themselves for landing.
Cat behavior expert Emily Parker explained that "this reflex is constantly working to orient the body so that the head is upright and the rest of the body can support it." Fun fact: They can also "flatten" out their bodies like parachutes to make them fall more slowly!
The caveat (more like cat-veat) is that they do need enough time and space to achieve this motion; the righting reflex can take less than a second, and they need at least two and a half feet to stick the landing.
Of course, the righting reflex doesn't make felines invincible. Cats can still sustain injuries from high falls, so don't get any ideas. Instead, trust that your four-legged friend has a super-cool innate skill and keep him or her safely away from any high windows or heights.