I once read a scientific analysis of all types of love, and the two things all types were said to have in common (when they're right) are respect and admiration for the other person. I'd agree with that, but if I think of my own experience with loving people I'd say it also involves a protective instinct (that was in the analysis too, by the way, but I know first-hand that it's there when I love someone). Since respect (I think) for others comes with the ability to have empathy and understand that others, just because they're a person (or even a creature) are separate living beings/people with feelings just like we have, I think empathy plays a big role in the ability to love. Something else is, I think, having a well balanced ego that allows us to know we're "as good as everybody else" but not "better than everyone else". We may have a protective instinct toward someone, but we can't love properly if we see ourselves as superior to them. I don't think a person who sees himself as inferior to everyone else "as a person" is free enough of his own needs, or sense of vulnerability, to be able to experience the healthiest kind of love toward someone else. Also, I think appreciation of the one we love plays a very big role, so ability to appreciate is probably an important component to ability to love.
As for where I think my own ability to love came from: I was treated with love and kindness as a small child, so I admired and appreciated my kind and caring parents so much (as well as observing and experiencing people's treating others with love, respect, and kindness), the ability to love just has been there as far back as I can recall. By the way, it's now known that nurturing in the first three/four years of a child's life actually alters brain development, which goes back to the thing that ability to love (at least for a whole lot of people) goes back to their infancy and early childhood days, and their parents. I think, though, inability to love can come to even those who got off to a good start because hurt and anger (maybe even frustration) can upset the normal course of emotional development (and sometimes, even brain development), in varying degrees depending on the degree of hurt and/or anger.
Similarly, I claim credit for the fact that my children are people who can love. It's not a unique or impressive accomplishment by any means, but it's one a lot of parents don't manage to do very well at. (And I credit my own parents for that particular accomplishment of mine as well. :) )