There are so many ways that we deceive ourselves. It would appear that humans are actually very bad at correctly viewing the world. From an evolutionary perspective many things really did not matter. The key factors were finding food and shelter in addition to successfully reproducing.
If a person's concept of the factors that influenced the course of his or her life was radically wrong it would not generally make any difference in their ability to survive. Questions such as "Is there a god?", "Does my god want me to pray to the east or in the evening" mean absolutely nothing in terms of survival. The answers that he or she would find would be heavily influenced by identifying patterns (that do not exist) in largely random data. As time progresses the answers would be pre-determined and taught by his or her culture from childhood. In more primitive societies belief would then have a survival advantage because of the need to have the support and protection of the society.
Given our complex, multi-faceted world I used to think that magical thinking was less likely to occur. It would appear from the behavior of billions of people (including me) that magical thinking is still the norm rather than the exception. Upon further reflection, this would seem to be the most logical state. In reality, as mentioned previously, magical thinking does not have much influence on survival in real terms. There is really no evolutionary pressure to not think magically. Even in today's world reproductive opportunities are not significantly reduced by magical thinking. In fact, if a particular magical belief is predominate; magical thinking may even increase a person's opportunities to find a sexual partner or partners. Furthermore, it is becoming less likely with improved standards of living and health care that any given person will not reach an age where reproduction is a viable option.
There are also the pressures imposed by various elements in any given society. We, on this board, have observed this numerous times. Challenging religious beliefs often results in someone or many someone's engaging in very strenuous efforts to defend the challenged beliefs. The defenses expose the underlying mechanisms used to justify continued belief in what has become unbelievable. Every argument can take many specific forms but a brief sampling:
1. Appeal to antiquity: "Our faith has been around for 150 years, or 1500 years, or 2000 years, ...; therefore my beliefs are correct."
2. Appeal to authority: "These experts (followed by a list of highly educated and successful people; physicists, biologists, financiers, etc) believe; therefore our religious claims are accurate."
3. Sunk costs: "Our ancestors gave so much for our religion thus sealing their beliefs in their sacrifice; therefore my religion is correct and denying that it is god's one true way would be disrespectful to my ancestors and their sacrifice."
4. False dilemma: "Either we continue to believe in my god and my religion must continue to exert pressure on society, or society will degenerate into immorality and lawlessness."
5. Negative proof: "You cannot prove that my god does not exist ; therefore there is a good chance that my god exists."
6. Package-deal: "Because my religion has always been an integral part of my family's culture; then my religion must always be part of my culture. If I separate my beliefs from my culture my culture will no longer be viable."