Sigmund Freud, theorized that belief in a God or Gods comes from long lasting impressions made on adults by childhood experiences.(Molloy) He stated that human behavior and mental states were mainly the result of the workings of the mind in each individual person - especially the ongoing, lifelong struggle between the ego and the super-ego, as each person grows and matures. For Freud, he saw religion as a psychological disease. According to Freud, these experiences of fear as well as security were the basis for an adult attempt to deal with the anxieties of a complicated present and unknown future. People with more intense religious feelings suffered this unresolved tension more strongly in childhood; people whose ego was able to regulate more easily had less religious tendencies. For Freud, God is not something which "really" exists - it is the product of human psychopathology.
Another great scholar William James a psychologist was one of the leading proponents of the school of functionalism in psychology, and pragmatism in philosophy. He came to his ideas on religion via an unusual course of study. His views on religion reflect these inclinations. James viewed religion as a manifestation of an urge towards spiritual belief which is a part of the human life. James wrote that religion brings “a new zest” to living, provides “an assurance of safety,” and leads to a “harmonious relation with the universe”(Molloy.Chap.1, page.12) . In his approach on religion James is basically stating that there is no use in condemning religion as a general phenomenon , because it is an inevitable part of life (although we could reject specific religious ideas or practices).
Freud and James both wrote quite extensively on religion I must say. Freud's conclusion is that religion is illusory wish-fulfillment proceeds