How can I be sure that I am being polite?
How does one be polite there? Are there certain rituals or phrases
Try to be polite and even if you do something slightly wrong, Japanese people are pretty sharp at detecting your intention to be polite. When speaking English, they expect less formality. If you use Japanese, stick to the -imasu forms and any other polite language you know, like putting -san after names (-kun for males, like 'sir').
Japanese people bow to each other a lot, so I would recommend bowing when saying hello, goodbye, or thank you. If it's to a store clerk, it's not really necessary to say thanks, but I do with a small head bob. However, if it's to someone I am being introduced to, it should be done standing still. Women generally bow with their hands clasped together while bending at the waist with a straight back. Eye contact is not made while bowing. Men have their arms straight at their sides while bowing. Generally, the older or more important the person you are bowing to is, the lower you should bend when bowing to them.