There are two major religions in Japan – Shintoism and Buddhism. But, in fact, none of these religions is "pure" because they historically had been mixing, borrowing and adopting rituals and features both from each other and from various confessions. Therefore some orientalists call religious system existing in Japan Shinto-Buddhist syncretism. Nevertheless they divide into Shinto shrines and Buddhist temples though if you are a layman it is often difficult to identify the difference by exterior.
When visiting a shrine or temple you should respect this place holy for Japanese. You should be quiet and calm. By the term "shrine (temple)” it is usually known not only a building (more often it is even complex of buildings), but also adjacent territory. You must put your footwear off at the entrance of every building. Sometimes they give special slippers out in shrines and temples.
As a rule you can freely take pictures, but there are some cases when it is necessary to ask for permission from servants whether it is allowed to take photos of a particular room or servants themselves. If a shrine or temple is affiliated to a monastery it is probable that monks will not allow taking pictures of themselves. In any case it is better to pay attention to signs and pointers to avoid any problems. Major shrines and temples popular among the tourists have all information dubbed in English.
Summarizing the above said, it should be mentioned that wherever you go – to Japan or other countries – you should know and at least try to observe etiquette and rules of conduct accepted in the country in order to stay civilized person.