If humans stop believing in God, then it could give rise to severe mental trauma to human beings. God is an essential component of completing the cycle of life, the answer to questions like "What happens after you die" If science can provide a soft answer to this question, then we many not need religion. Check out A Thesis on the Nature of Religion So, that important void is filled in by religion and God. Without it, life would be..... very incomplete
That is no doubt why it was invented, but... 1. It doesn't make it true 2. Doesn't mean some people are happy expecting nothing to happen after they die. I mean, what kind of "mental peace" must someone have to waste this life in the vain attempt at winning themselves another one? and what kind of person is able to trick themselves into believing something just because it makes them feel better? psychologists call that denial, it's very unhealthy.
I like to believe I can do anything I put my mind to. I am aware that, in an absolute sense, that is likely untrue. Nevertheless, that belief motivates me to apply myself when I try new things. You may call that lying to myself to make myself feel better, but the results are indisputable. Actually achieving what I apply myself to is just a convenient added bonus at the end of the day.
I believe having faith that someone or something is helping you achieve your goals helps reinforce them and often brings them to bear. Whether he's real or not, I often 'know' that something is going to happen before it does. I believe that faith in knowing makes it more likely to happen.