My sources are http://www.ancient.eu/religion/, https://en.wikipedia.org/wiki/Ancient_Mesopotamian_religion, and the book, ‘Ancient Civilizations’, published 2006 by McGraw Hill and National Geographic.
The earliest forms of religion were borne out of people’s need to explain natural phenomena and to bring some sense of order to their lives. For example, the Sumerians (beginning around 4500 B.C) believed in many gods, each was thought to have power over a natural force or a human activity. In ancient Egypt, the main god was Re, the sun god, who was worshiped for the hope of good harvests. Other gods were Hapi (ruler of the Nile river), Osiris (ruler of the dead) and the goddess Isis (representing the loyal wife and mother).
In China, during the Shang dynasty, (1750 B.C), people worshiped gods and spirits. Spirits were believed to live in the mountains, rivers and seas. The people believed they had to make the gods happy by making offerings of food and other goods. They believed that angry spirits might cause farmers to have a poor harvest or armies to lose a battle. Spirits of ancestors were honored, and offerings were made in the hope that the ancestors would help in times of need and bring good luck.