When the Khmer Empire was formed in the early 9th Century, it was mainly Hindu, until the end of the 12th century, when the empire became Mahanaya Buddhist. This didn't last long. Sometime later, when the Sri Lankan race diffused throughout Asia, they spread their own type of Buddhism, Thevarada Buddhism, to the Khmers. Though the Khmers were followers of these foreign religions, they did not forget their local Gods and deities, like the Master of the Land, and human heroes that became Gods after death.
The Khmer people believed that their Kings were the "deva raja" or God-Kings. They believed that their Kings were divine in the sense that they were incarnations of the God, Shiva. The ancient Khmers strongly followed the Gods Shiva and Vishnu yet amazingly, some of them also followed the teachings of Buddha. Shiva, though, was the dominant religious figure for the ancient Khmers because he was looked upon as the protector of their empire. The beliefs of the Khmer were passed from one generation to the next through word of mouth.
The people from Ancient Angkor built many temples in honor of their Hindu rulers. A famous example, Angkor Wat, is one of the 7 Wonders of the World because of it's incredible magnitude and complexity. The temples were very important to the Khmers, and were built with materials meant to last forever, and a lot of hard work, such as master stonework and intricate carving, was put into these temples to make them look stunning.These temples had many purposes. Firstly, the obvious reason, is that they were places of worship to the Gods. Also, the high towers were used by the priests as astrological observatories. There were also other sections of the temples which were dedicated to rituals for things such as celebrating days of worship and naming new-born babies.
The Khmer believed in the Hindu Trinity, a group of 3 Hindu Gods that ruled the Hindu Pantheon (all of the other minor Gods). The Hindu Trinity consisted of Shiva, God of Rebirth and Destruction, Vishnu, the Protector, and Brahma, the Creator. The Khmers believed that Shiva would bring an end to each "universal cycle" with his destructive dance, and create a new cycle. They did not think that this power was a negative one, as it would cleanse the world. The Khmers worshipped Shiva in the form of a "linga", a stone pillar dedicated to him. Brahma was less commonly worshipped, and he is often seen in temple carvings as growing out of a lotus plant.
Buddhism was not as common as Hinduism in the Khmer Empire. In the 12th Century, most of the Khmer Empire was Mahayana Buddhist. This meant that they believed in the bodhisattvas, or "New Buddhas". These people are said to have stopped their progress just before Enlightenment to help the human race. Later on, when the Sri Lankans spread throughout Asia, they spread the Thevarada Buddhismn to the Khmers, which is the type of Buddhism that is commonly practiced today.