I think it is mostly to fill a hole, a lack of affection. Maybe something that we find hard to get from humans, it's easier to get it from animals since they don't judge.
Maybe it's also to feel we're helping. We want to feel that we are needed so by providing a pet what he needs: food, water a home, and also affection it makes us feel good.
Maybe we also feel the need to have control, so we try to get control over our pets. Like training our dog could make us feel we have the control, it makes us feel superior.
Other than that, I don't think there is any other use to have pets. If we wouldn't have affective problems, I don't think we would really feel the need to have pets. Except, or course, where they can help for example, at the farm, or dogs for blind people. These are great benefits that aren't from an affective problem.
I have an affective problem because I would like to have all the animals in the world lol. I would like them to be all friendly to me, and if I see an animal that doesn't like me, I sometimes take it personally and feel hurt.
That's my opinion.