fezzy's comment was offensive, but one of the main attractions that religions have for people is definitely that they offer hope and sustenance beyond the physical, and people who are down on their luck in life are more likely to look for those things. I don't think it's a great mystery. Nor is it surprising that modernity has not succeeded in solving all of humanity's problems.
But then religion is only worthwhile as a blanket, which is nice but rather naive. I suppose people can't be forced not to retreat to religion for comfort, but it baffles me why it is encouraged. Surely we should be facing our problems?