It's actually a form of "I can do it". People feels better after praying. (For me at least) It's not about surrending to a god, it's asking for motivation to continue even in the worst scenario.
Science will make humanity go forward, but spirituality will make people's mental health still alive in hard time.