Foam rollers are great tools for improving range of motion before a workout and easing soreness as part of the cooldown after exercise.
Rollers come in different densities. As a general guideline, choose low-density if you're a beginner or if you're rehabbing and need to slowly work to increase blood flow to the injured area. Medium-density rollers often have raised lines to encourage more oxygen and blood to reach the spot you're working on. High-density foam rollers are made for more advanced athletes.
The technique for using a foam roller is simple. Position the roller directly under the muscle or area you want to reach and gently roll back and forth on it. Take care not to roll over any joints.
For hamstrings, position the roller under your legs, just above the backs of the knees. Press your hands into the floor to lift your rear off the ground and slowly roll back and forth along the length of your thighs.
For calves, move the roller below the knees and roll to just above the ankles and back.
For quads, turn onto your stomach and place the roller under your thighs. Prop yourself up on your elbows before you roll back and forth.
If you feel a knot or trigger point, stop when you roll onto it and press into the roller for 20 to 30 seconds to help break it up. Note that you shouldn't feel any pain when rolling. Pain could be a sign of injury that needs a doctor's attention.
The American Council on Exercise has more on the benefits of foam rollers and how to choose the right one for you.