Bowing in Japan has many functions in one. It expresses the feeling of respect, thanking, apologizing, greeting, and so on. For example, you can bow, when you say, "thank you", "sorry", "hello", "good bye", " welcome", "congratulations", "excuse me", "good night", "good morning", and more.
Bowing seems simple, but there are some different ways. It depends on the social status or age of the person you bow to. If the person is higher status or older than you are, it's common to bow deeper and longer, showing respect.
The most informal bow is a bend of about 15 degrees for a casual greeting. In casual daily life situations, bowing is often a nod of the head. The most common type of bow is done to a 30-degree angle to greet customers or to thank someone. It's often seen in Japanese business situations. A more formal way of bowing is performed to a 45-degree angle looking down at your feet. This type of bow signifies deep gratitude, a respectful greeting, a formal apology, asking for favors, and so on.
Basically, it is polite to bow, bending from your waist with a straight back. Men usually keep their hands in their sides, and women usually put their hands together on their thighs with their fingers touching.