Shaving with an electric razor makes sense to me: the holes in the foil are large enough for hair to protrude into them and be sheared off, but skin can’t bulge far enough in to be nicked by the cutters.
I’m more puzzled by shaving with manual razors. an ultra-sharp blade is held against the skin at a very shallow angle and as it moves, it somehow cuts hairs off, but doesn’t plane off any skin. Or at least, not as much skin as I would expect. After all, this is not much different from procedure by which skin is harvested for a skin graft (documentary example here, showing the harvesting tool, which appears to function an awful lot like a manual shaving razor).
So why does shaving with a manual razor cut a lot of hair and relatively little skin?
Basically, you can cut or scrape yourself fairly easily with an old double-edged “safety” razor. (“safety” means you can only cut yourself 1/16" deep) Typically this is when you get the angle wrong and go too steep and just cut into your skin, or if you get the blade somehow not square to the direction you’re moving and then get the angle wrong. Safety razors also help the shaver keep the angle correct so that there’s a minimum of scraping, and a maximum of cutting.
It’s kind of like how you can scrape stickers off of things that a single-edged razor might scratch if you got the angle wrong, like a painted plastic bumper on a car.
Old-school straight razors totally rely on the shaver to regulate the angle and depth- there’s a reason they’re called “cutthroat” razors- they’re effectively a very sharp non-pointed knife.
It takes off plenty of dead skin cells, and even some live ones, and if you pass the razor over any protuberance there will be skin cut and bleeding. Modern razors are designed to compress and lubricate the skin just before the blade passes over, straight razors lack that and require a skilled hand to avoid a lot of blood. Any lateral movement of the blade will slice the skin easily.
There has been a least one other thread that discussed the legality of straight razors at barber shops, and I just learned it requires special insurance and certification to use one here in RI (according to my new barber). He uses a straight razor with disposable blades to get around those requirements.
Skin is soft. Whiskers are hard. Imagine pulling a big blade across a memory-foam mattress to slice off “pool noodles” sticking more or less straight out of the foam. The skin flexes out of the way and the blade catches on and cuts the much stiffer whisker.