Benjamin Beit-Hallahmi, Psychological Perspectives on Religion and Religiosity, pg 26-27:

Human brains look at the environment and it seems like all they see are agency, intention, and consciousness, whether they exist or not. Powerful mechanisms lead to the attribution of consciousness and volition to numerous non-human objects, real and imagined. The apparently universal tendency for over-detecting causality and agency is so powerful because of the cost of not detecting them in ambiguous situations. The ability to recognize threats and opportunities, and to identify intentions, is crucial. The search for causality is vital for human survival, and because of the way it operates humans often cannot tell the difference between intentional actors, imagined intentional actors, and inanimate objects (Tremlin, 2006, p. 74). They also connect causation to conscious intentions.

Related to the over-detection of causality are several cognitive shortcuts, which pull the mind toward supernaturalist ideation. They undoubtedly overlap, but their analysis as discrete processes provides important insights. Our innate animism, anthropomorphism, Theory of Mind (TOM), dualism, and teleology lead to seeing ourselves as surrounded by minds and by intentions, real (in the case of other people) and imagined (in the ease of spirits and objects).