There are a lot of people without much hope. Politicians ignore them, they are poor, uneducated, they may suffer from illness. For the truly desperate with no hope of justice or progress, the mistaken belief that the villains in their lives will be judged and that they will have a better life after death is all that keeps them going. No matter how much you get shit on, somebody with power, the Creator, loves and cares about you, and he's got your back. That's extremely comforting. I think evolution selected for religious thinking for this very reason, as it's a great way to keep an organism going and reproducing when nothing else will.
I'm obviously not religious, but I think a lot of atheists do religion a disservice when they ignore this. I don't think religion does more harm than good for this reason.
I also think the main reason a lot of first world countries are becoming less religious is that their social safety nets prevent this kind of abject desperation. Without the desperation, the survival instinct of religion doesn't kick in as strongly.
Good on you, religion.