Why do cats purr? Desmond Morris claims in Cat World (1996) that a cat's purring is a sign of friendship: "either when it is contented with a friend, or when it is in need of friendship-as with a cat in trouble." A similar opinion is given by Turner & Bateson (The Domestic Cat: the biology of its behaviour, 1988): "...the purr helps establish and maintain a close relationship [between kittens and their mother]. Probably for similar reasons, the purr is used by adults in social and sexual contexts."
My cat Marissa purrs primarily under 2 circumstances. First, when she is sitting or kneading near us like she was when I took this picture.
Second, when she is asking for food. The latter behavior is often accompanied with vigorous head rubbing, especially in the mornings. Here is a recording of her purring I made one morning a few days ago with my iPhone. I had just gotten up and opened the bedroom door. She came in and started rubbing against my legs while purring loudly.