There are many crosscutting issues in this topic. Some of the preposterously untrue items within religion can be likened to junk DNA. There are segments of DNA that do not accomplish anything. They do not cause problems for the organism so there is no selection pressure to eliminate the junk DNA. The preposterous things in most religions are often similar to junk DNA in that they are little more than curiosities in terms of actual behaviors in a person's day-to-day existence. They do not cause any harm but they also do not do any good. People tend to lump most things from a belief system together and do not have access to the correct type of information or the analytical and scientific tools to successfully parse the various components of their religion.
Religion provides hope and help people overcome very difficult times in their lives when they may just give up and perish because of external factors or at his or her own hands. Religion often provides a tight-knit community including emotional and material support in times of want.
As humans we are not very good at determining true causal relationships. The beneficial aspects of religion are very difficult for even a very fastidious observer to parse from the erroneous. The scientific method is so new and little more than a century has passed since the advent of robust social science studies. Even with this scientific toolkit and the research findings that have amassed over the preceding decades, it is difficult for people to separate fact, fiction, logic, and their own emotions.
Religion did and does have some survival advantages. The challenge is for the believer and nonbeliever alike to determine what factors help, those that harm, and which are benign but relatively useless.