Do hairless cats like Sphynx get fleas or not? It would be really cool if they don't but I'm not sure.
They can be bitten by fleas, but don't get an infestation like cats with hair do.
So fleas only live and thrive in hair?
Yes. Hair gives them protection and warmth.
Apart from anything else, it's much easier to spot a flea on a hairless cat and to get rid of it.

Then if I have a cat, can I just shave him? To get rid of his fleas?

Yeah, they can be bitten, but don't get infested, like furry ones, that's true. But I wouldn't recommend shaving your cat, if you want to get rid of fleas get him seresto collar or similar, it works well in case you spotted one or two bugs. In case of heavy infestation, you should go to the vet and ask for proper pills or even injections.