How do I prevent little red spots on my legs after I shave?

Don't shave so close. You're probably shaving very close with a multi-blade razor. Those razors actually shave below the skin line, causing ingrown hairs which appear as red bumps. Try a single-blade or electric razor. You won't get as close a shave, but that's the idea.