Japanese society went from a mixture of folk religion, in an agricultural society to a little more codified religion that took the name of Shinto (神道) meaning litteraly the way of the kami.
We discuss Shintoism in more detail on its own page but let's summarize here by saying that the kami are not gods in the Christian meaning of the term. The term is often translated as god but it also includes forces of nature and other superior being. they can be both good or evil. They would be easier to understand as spirits but in the shamanic way, not the ghost sense of the word.
As in many societies, religion became a justification for the power in place to rule over the people. In Japan, Ō no Yasumaro wrote the Kojiki in 712 on the request of the empress. He compiled the various myths about the creation of the Japanese islands and the birth of different kami.
This text explained that Amaterasu-ōmikami, the goddess of the sun, would have sent her grand-son to control the earth and he would have become the first Japanese emperor. His descendant were said to be divine. This myth has been used all the way to 1946 when the then emperor, Showa, announced that he renounced the claim of being divine.
There is no religious right like in Christianity in Japan but the closest thing would be the right wingers who still believe that the emperor is divine and using it as a justification to claim being a superior race. Fortunately they are a very small minority.
In 552, Buddhism is introduced to Japan and is quickly used by the main clan to take control of the others and justify a movement toward modernization and the adoption of Chinese governmental and cultural models. From then, the religion of Buddhism became a religion of the elite while the people still worshipped the kami. This started the blend that we now know as Japanese religion.
Slowly, the major Shinto kami where incorporated in Buddhism, given roles and where worshipped alongside the Buddhas thus mixing both religion, which explain why the peaceful co-existence through the ages.
In 1868, the young emperor Meiji gained power over the Shogunate thus ending 260 years of dictatorship from the Tokugawa family. This is called the Meiji restoration.
In the wake of modernizing the country and passing from a feudal society to a modern society equal to the major powers of the day, Meiji disbanded the various samurai clan controlled armies to create a central, national army with modern weapons and tactics. This basically started the slow but constant march toward the fascist controlled military governement that attacked Pearl Harbor in 1941.
The same movement used Japanese religion to emphasize the claim that the emperor was of divine origin and literally brain-washed the population. In this effort, Shinto was institutionalized into what came to be known as state Shinto. Under this system, ideals, rituals and institutions were created by the government to promote the divinity of the emperor and the uniqueness of Japan.
The military government cracked down on emerging new religions that had the tendency of being more peaceful and critics of the government policies.
Also during that era, the government ordered the separation of Buddhism from Shinto. Until that point in time, the worship of Shinto and Buddhism was barely different and was often done in the same buildings. This wouldn't do for the imperial agency as Buddhism was a foreign religion thus working against their policies of a greater Japan.
They closed thousands of temples, confiscated land, forced a return to lay life of monks, destroyed books, statues and other Buddhist property. The policy was later abandoned but I'm sure it has contributed in great part to the decline of proper Buddhism and the rise of funeral Buddhism as we can observe it today.
Nowadays, Japanese religion is a peaceful co-existence of various religions, ancient or more modern. 98% of the population declares itself Buddhist even if they don't practice. They will visit temples and shrines for the New Year and for other rituals like births, funerals and marriages.
Religion is not taught in school, the young people don't know anything about the rituals and the history of the different religions.
With the lack of organization and power, the old religions slowly fade away and stronger, richer and more organized 'new religions' take their place.
The Japanese people are very tolerant of other religions and will rarely talk about it. On the contrary, people who try to convert others are often ostracized. This is mainly why some religions like Soka Gakkai and the Jehovah’s Witnesses gained bad press.