some maintained that it originated with a belief in spirits ( animism ) , then evolved into the notion that there were many gods ( polytheism ) , and ultimately emerged as the ideal of a single god ( monotheism ) .