To use a foam roller for exercise, you must have a baseline understanding of muscle anatomy. Your objective is using the foam roller to stretch and release your tight muscles by rolling those muscles on the foam roll.
There are several different areas that you can stretch using a foam roller, but the most common is the hip region. Two good stretches are for the piriformis and for the IT Band.
For the piriformis, cross your right ankle over your left knee and sit on the foam roll with the back of your right hip on the roll. Then, while placing weight through the roll, move the roll side to side. You may find this position a little irritating while you are performing the exercise the first few times, as it is an active release technique. You can do this for 30-60 seconds at a time.
For the IT Band, lay on your side with the outside of your thigh on the roll and the roll oriented perpendicular to your body. Then, start rolling back and forth so the roll travels between your knee and your hip. You could also find this position somewhat irritating, especially the first time you do it.