One overcast afternoon in mid-July, a deafening boom surged through Colorado’s El Paso County Fair. At the center of the commotion lay a woman, flat on her back, her skin a mess of blue and violet. Her chest was still. First responders rushed to the scene, strapping an oxygen mask onto her lifeless face and performing CPR. After several tense moments, her chest began to rise and fall on its own. She had just survived a lightning strike.

You’d think that getting slapped with 300 million volts of electricity raining down from the sky would fry you from the inside out, but a surprising 90 percent of people who get struck by lightning survive to tell the tale. In fact, NOAA sets the odds of being struck by lightning in any given year somewhere around 1 in 1.2 million — much better odds than dying in a car crash or, more morbidly, Donald Trump becoming America’s 45th President.

Not all lightning strikes are equal. The direct strike, straight from above, is, unsurprisingly, the deadliest.

And yet, when you consider what a lightning strike actually does to a person, it seems impossible that anyone could survive. Think about it: In addition to containing enough electricity to power 6,000 tasers, a lightning bolt also heats surrounding air to 50,000 degrees Fahrenheit — over 40,000 degrees hotter than the surface of the Sun.

How do the 240,000 people around the world who survive lightning strikes each year cheat death?

Survival, it seems, comes down to a combination of good planning and sheer luck. Not all lightning strikes are alike: Some bolts will travel down a taller object, like a tree, then streak down and lash out at unsuspecting passers-by. Others crash into the ground, spreading their currents like gnarly fingers through roots, then leap upward through a person’s feet. And still others — the deadliest ones — strike straight down, like spears hurled from the clouds.

When lightning travels through another object before striking a human, some of its initial potency is lost. But it's still pretty potent.

When currents are forced to pass through other materials before electrifying a body, some of their original energy and heat is lost, somewhat mitigating the final blow. It’s not surprising, then, that the worst of the lot are direct strikes, which don’t just sear burns on the skin’s surface — sometimes in gruesome yet gorgeous patterns known as Lichtenberg figures — but also interrupt the body’s cardiovascular and nervous systems, which rely in turn on the body’s own electric signaling to function. While these represent, undoubtedly, severe physiological injuries, they’re not technically deadly unless they halt body function altogether. And that’s a surprisingly difficult thing to do.

The 10 percent of people who die do so quite brutally, in the electric grip of cardiac arrest — that is, their hearts straight-up stop — at the moment they’re struck. Others will pass days later, as irreversible brain damage makes it impossible for the body’s functions to persist.

And sometimes lightning gets you from the ground up. Still deadly if you're unlucky.

The good news is that there are way fewer lightning strikes today than there were about 60 years ago, when there were two injuries for every person that died from lightning. Farmers and agricultural workers, toiling in the fields, used to be among the hardest hit, but now the bulk of us have moved to the cities. Advances in technology have helped too, albeit inadvertently: Because we’re no longer bound to corded phones, there’s no way for electricity to travel through the ground, snake through wires, and jump out through a phone receiver to zap our heads.

Still, if, like Rihanna (or, controversially, Taylor Swift), lightning strikes every time you move, it’s probably safer to avoid stormy situations altogether. As the dramatic events at the El Paso County Fair demonstrated — together with the 20 deaths that have happened in the U.S. this year alone — the science of lightning strikes can only go so far at keeping us safe. Pro tip: As the experts at warn, when thunder roars, go indoors.