One of the things that triggers a feeling of love in humans is utter dependence, a lack of control which we put in others hands, however correctly. Developmentally this is important. As children, we are totally dependent on our parents, and we put our lives in their hands (hopefully rightly!); this relationship builds up the deep, emotional bond that we generally share with them. Children who miss this opportunity, through neglect or abandonment, can often end up incapable of or having difficulty with forming deep bonds later in life. Of course, it's only one mechanism, there are other ways for love to emerge! But for today, for this post, it's one of the two I'm looking at.
A similar mechanism is found in victims of Stockholm Syndrome. The victims are said to love their captors after being shown token acts of kindness while under the threat of death or torture. The dependence is there, but more specifically, there is a threat. The survival instinct kicks in, encouraging the behavior. While the case giving it the name of Stockholm may be a misnomer, it has been shown to exist, albeit in less cinematic situations than a kidnapping gone wrong.
The two mechanisms combine, often with others, in emotionally and/or physically abusive relationships. While intellectually, the victim will know that the abuser is not treating them well, even that they should leave them, they often report a deep abiding love for the person (and probably an unhealthy amount of fear), and stay, to the discredit of themselves, society, and often the children in the family. The abuser will usually seek to limit emotional outreach, forcing the dependence, or simply withhold money, to foster the dependence. The cruelty comes naturally, and the token kindnesses are generally overblown by the victim's eager mind.
When the victim is confronted about this dissonance between behavior and rationality, they generally dissemble, or rationalize: consider the cliche, "I deserved it."
It's interesting that the times people are most inclined to pray when they are at their most desperate, when they are feeling completely powerless over the course of their life. It's at times like these when people say, "Let go and let God," or are on their knees at every opportunity (never mind those of us who were raised to be praying almost constantly, anyway). It's also interesting that life, will often, arbitrarily and without provocation, beat us down, crush our dreams, and generally do terrible things to us. It also does very kind things for us once in a while, and for the most part, we agree that life IS worth living, despite the setbacks. A religious person, convinced that God is in charge of their lives, would ascribe the random chances of life to the agent behind it; and there you have two mechanisms mentioned above- dependence and cruelty mixed with token kindness.
I think, for many people, religion is simply an abusive relationship with the universe.