the only means of knowing things
Religion is a way of feeling, not a way of knowing.
Instinct is an example of an alternative way of knowing, many religions simply document moral instincts and then claim to be the sole source of morality. Morals are as innate to humans as their physical senses, until very recently science had no idea (and no interest) as to where they came from, religion has always provided stories to fill that gap. Stories are more powerful than people assume, the mind of the worshiper creates a character called god based on the story, it then asks the character questions and favors. The practice of prayer simply reenforces the character by asking you to regularly converse with the character you have built. Now the real hook is when that prayer is "answered" your mind highlights it and attributes it to the god character, like gamblers who keep pulling the lever, worshipers will keep on praying every night.
God is not the only character in your head, it's just as easy to imagine yourself talking to Obama (re: Clint Eastwood and the empty chair). The conversation you have will be based on personality attributes you have assigned to him, some of those attributes might even match the real ones since Obama can be observed. Every human is born with a basic "theory of mind" that "explains" why things behave the way they do, it instinctively assigns personalities to everything both animate and inanimate. If you doubt that then listen to yourself the next time you try and explain to a mechanic what is wrong with your car, both of you will use words that describe the personality of your car, theory of mind is deeply embedded in our language because it's deeply embedded in humans.
Combine the "theory of mind" with he fact that human societies are always hierarchical and it's kind of obvious why humans tend to create a mother/father personality that oversees the entire universe. In the early days of human society that personality was obvious and real, it was simply the big ball of fire in the sky that from direct observation could be seen to regulate all life.