In the Shang Dynasty (about 2000 BC), the earliest period we know much about, people in China worshipped a lot of different gods - weather gods and sky gods - and also a higher god who ruled over the other gods, called Shang-Ti. People who lived during the Shang Dynasty also believed that their ancestors - their parents and grandparents - became like gods when they died, and that their ancestors wanted to be worshipped too, like gods. Each family worshipped their own ancestors.
Around 1500 BC, people began to use written oracle bones to try to find out what was going to happen in the future. By the time of the Chou Dynasty (about 1100 BC), the Chinese were also worshipping a natural force called t'ien, which we usually translate as Heaven. Like Shang-Ti, Heaven ruled over all the other gods. Heaven also decided who would be the Emperor or Empress of China. The emperor or empress could only rule as long as he or she had the Mandate of Heaven (as long as Heaven wanted him or her to rule). You knew when the emperor or empress had lost the Mandate of Heaven because he or she would then be overthrown by somebody else who would become the new emperor or empress.
Around 600 BC, under the Eastern Chou Dynasty, and for the next two hundred years, there were a lot of new ideas in Chinese religion. First, a Chinese philosopher named Lao Tzu (he may be mythical) created the philosophy of Taoism, which became very popular. Taoism holds that people should not try to get their way by force, but through compromise and using natural forces in their favor. It is partly a philosophy, and partly a religious faith. Taoists believe that there is a universal force flowing through all living things, and that respecting that force is essential to a happy life.
Not long after Lao Tzu, another Chinese scholar called Confucius created a different philosophical system we call Confucianism, which disagreed with Taoism but also became very popular. Confucianism holds that people should do their duty and follow their leaders and the gods faithfully. Order is the way to peace. If everyone just does what they are told, and what they are supposed to do, there won't be any fighting and nobody will be upset.
There were two other important philosophical schools of this period. One was started by Mo Tzu, which suggested that the way to happiness was for everyone to treat all other people as well as they treated their own families. The other was Legalism (a kind of Confucianism), which believed that people were all basically bad, and needed to be kept in line by strict laws and harsh punishments in order to create order and peace. Legalism was very important in the way the Chin Dynasty worked (about 220 BC).
But these new philosophies did not end the old religious practices. Everybody kept on worshipping their ancestors and the traditional Chinese gods, and they kept on believing in the Mandate of Heaven