Many Catholics reveled in the pope's whirlwind visit to the East Coast of the United States last month. But as the devout return to life as usual, nonreligious Americans may be left scratching their heads, wondering what all the fuss was about.

The vast majority of the U.S. population does not belong to the Catholic Church, and a growing percentage of Americans are not affiliated with any organized religion at all, according to a recent survey by the Pew Research Centers. So the question then becomes, what role does religion play in today's American society? Perhaps oddly, that question can be answered by a group of people not usually associated with religion: scientists.

Despite the popular belief that science and religion (or science and the supernatural, more generally) don't quite go hand in hand, scientists have quite a lot to say about this topic — specifically, why such beliefs even exist in the first place. [Infographic: Views of Catholics in America by the Numbers]

The 'god faculty'

There are many theories as to how religious thought originated. But two of the most widely cited ideas have to do with how early humans interacted with their natural environment, said Kelly James Clark, a senior research fellow at the Kaufman Interfaith Institute at Grand Valley State University in Michigan.

Picture this: You're a human being living many thousands of years ago. You're out on the plains of the Serengeti, sitting around, waiting for an antelope to walk by so you can kill it for dinner. All of a sudden, you see the grasses in front of you rustling. What do you do? Do you stop and think about what might be causing the rustling (the wind or a lion, for example), or do you immediately take some kind of action?

"On the plains of the Serengeti, it would be better to not sit around and reflect. People who took their time got selected out," Clark told Live Science. Humans who survived to procreate were those who had developed what evolutionary scientists call a hypersensitive agency-detecting device, or HADD, he said.

In short, HADD is the mechanism that lets humans perceive that many things have "agency," or the ability to act of their own accord. This understanding of how the world worked facilitated the rapid decision-making process that humans had to go through when they heard a rustling in the grass. (Lions act of their own accord. Better run.)

But in addition to helping humans make rational decisions, HADD may have planted the seeds for religious thought. In addition to attributing agency to lions, for example, humans started attributing agency to things that really didn't have agency at all. [5 Ways Our Caveman Instincts Get the Best of Us]

"You might think that raindrops aren't agents," Clark said. "They can't act of their own accord. They just fall. And clouds just form; they're not things that can act. But what human beings have done is to think that clouds are agents. They think [clouds] can act," Clark said of early humans.

And then humans took things to a whole new level. They started attributing meaning to the actions of things that weren't really acting of their own accord. For example, they thought raindrops were "acting for a purpose," Clark said.

Acting for a purpose is the basis for what evolutionary scientists call the Theory of Mind (ToM) — another idea that's often cited in discussions about the origins of religion. By attributing intention or purpose to the actions of beings that did have agency, like other people, humans stopped simply reacting as quickly as possible to the world around them — they started anticipating what other beings' actions might be and planning their own actions accordingly. (Being able to sort of get into the mind of another purposeful being is what Theory of Mind is all about.)

ToM was very helpful to early humans. It enabled them to discern other people's positive and negative intentions (e.g., "Does that person want to mate with me or kill me and steal my food?"), thereby increasing their own chances of survival.

But when people started attributing purpose to the actions of nonactors, like raindrops, ToM took a turn toward the supernatural. [Infographic: Americans' Beliefs in Paranormal Phenomena]

"The roaring threat of a thunderstorm or the devastation of a flood is widely seen across cultures as the product of a dangerous personal agent in the sky or river, respectively," said Allen Kerkeslager, an associate professor in the Department of Theology and Religious Studies at Saint Joseph's University in Philadelphia."Likewise, the movements of the sun, moon and stars are widely explained as the movements of personal agents with extraordinary powers,"Kerkeslager told Live Science in an email.

This tendency to explain the natural world through the existence of beings with supernatural powers — things like gods, ancestral spirits, goblins and fairies — formed the basis for religious beliefs, according to many cognitive scientists. Collectively, some scientists refer to HADD and ToM as the "god faculty," Clark said.

In fact, human beings haven't evolved past this way of thinking and making decisions, he added.

"Now, we understand better that the things we thought were agents aren't agents," Clark said. "You can be educated out of some of these beliefs, but you can't be educated out of these cognitive faculties. We all have a hyperactive agency-detecting device. We all have a theory of mind."

For the good of the group

But not everyone agrees that religious thinking is just a byproduct of evolution — in other words, something that came about as a result of nonreligious, cognitive faculties. Some scientists see religion as more of an adaptation — a trait that stuck around because the people who possessed it were better able to survive and pass on their genes.

Robin Dunbar is an evolutionary psychologist and anthropologist at the University of Oxford in the United Kingdom whose work focuses mostly on the behavior of primates, including nonhuman primates like baboons. Dunbar thinks religion may have evolved as what he calls a "group-level adaptation." Religion is a "kind of glue that holds society together," Dunbar wrote in "How Many Friends Does One Person Need?: Dunbar's Number and Other Evolutionary Quirks" (Harvard University Press, 2010).

Humans may have developed religion as a way to promote cooperation in social groups, Dunbar said. He noted that primates tend to live in groups because doing so benefits them in certain ways. For instance, hunting in groups is more effective than hunting alone. But living in groups also has drawbacks. Namely, some individuals take advantage of the system. Dunbar calls these people "freeriders."

"Freeriding is disruptive because it loads the costs of the social contract onto some individuals, while others get away with paying significantly less," Dunbar wrote in a New Scientist article, "The Origin of Religion as a Small-Scale Phenomenon." As a result, those who have been exploited become less willing to support the social contract. In the absence of sufficient benefit to outweigh these costs, individuals will leave in order to be in smaller groups that incur fewer costs."

But if the group can figure out a way to get everyone to behave in an unselfish way, individual members of the group are less likely to storm off, and the group is more likely to remain cohesive.

Religion may have naturally sprung up from this need to keep everybody on the same page, Dunbar said. Humans' predisposition to attribute intention to just about everything (e.g., volcanic eruptions, lunar eclipses, thunderstorms) isn't necessarily the reason religion came about, but it helps to explain why religions typically involve supernatural elements that describe such phenomena.

Follow Elizabeth Palermo @techEpalermo. Follow Live Science @livescience, Facebook & Google+. Original article on Live Science..