How are snipers hitting human sized targets from miles away?

I'm not super into guns, which may be why I'm flabbergasted, but I've grown up shooting guns and hunting, and I just can't fathom it. The longest recorded sniper kill was almost 2 and a half miles away. It took the bullet 9 seconds to reach the target. Not only that but the 5 longest recorded kills we know of were over a mile and a half away. I've seen a human 2 and a half miles away, and it's like picking out a grain of sand at my feet (not exactly, but you get the idea).

I understand you can calculate (roughly) the factors involved; Wind speed and direction, bullet drop, Coriolis effect, the spin of the bullet, whether it's uphill or downhill, but even air density, visual distortion, and variations in the weight and load of the bullet.

Even being able to accurately calculate most of that, there is no two points on earth with exactly the same gravity, and even small drafts of wind can cause huge bullet drift. The visual distortion can be like trying to pike a fish under feet of water. I ride motorcycles, and I know if anything all these things can change feet by feet. At 2.5 miles, even with a flag and wind sock, how are they calculating the deviations in between?

These guys (along with a spotter I know) are not only accurately identifying the target, but they're making these calculations within minutes or less, and accounting for a 9 SECOND FLIGHT TIME, and hitting a human torso.

I know they're not using the average hunting scope, shooting probably tens or hundreds of thousands of rounds during training, and they have calculatory aids, but with all these factors and the tiny deviations they can cause, at that distance I just don't understand.

My initial thought is it's mostly or all luck, but these might be and most likely are the only chance at a shot like this these guys get in their life. HOW ARE THEY DOING IT!?