Shaving

How do you prevent razor bumps and ingrown hairs when shaving ?