A good shaving technique is paramount in preventing ingrown hairs. It starts with having the right tools for the job and doing a little prep work.
First, let's talk about those tools. If you're wet shaving, you'll need a razor (disposable, cartridge or safety), a thick shaving cream or lubricating shaving gel, and warm water. Make sure that the razor's blade is sharp -- the sharper the blade, the better it is for removing hairs in the fewest strokes possible. If it's a week old, it's not sharp enough.
Shave immediately after showering or make shaving part of your in-shower routine -- this lets you take advantage of the steam. The steamy room will help to open your pores and make hairs softer and easier to shave. Smoothing shaving oil on your face before lathering up with shaving gel, a step commonly overlooked, can also help make shaving easier while decreasing the irritation caused by the razor.
Now, how's your technique? While shaving against the direction of hair growth will get you a closer shave, it also increases your chances of ingrown hairs. Shaving in the same direction as your hair grows -- shaving with the grain (this is usually going to mean downward strokes) -- may also help to minimize nicks and ingrown hairs. Refrain from pulling your skin taut as you shave -- while this is another common technique to get a close shave, it can also increase the likelihood of getting shaving bumps. Shave with just one stroke (or as few as it takes) to remove the hair from each section of skin. Rinse the blade in hot water after each stroke, and splash cool water on your skin when you're done.