Although the culture is changing with the more relaxed younger generations, Germans still adopt a fairly formal approach to their dealings with the world and one another. This is clear from the range of greetings used, both at different times of the day and in different regions throughout the country.
At the start of the day you can use Guten Morgen, or simply Morgen, Good Morning or Morning, or the catch-all phrase Guten Tag, Good Day. Guten Tag can also be used to mean Good Afternoon, and indeed as a general greeting throughout the day. After about 6pm Germans will greet each other with Guten Abend, Good Evening. Gute Nacht, Good Night is used either when saying goodbye at the end of the evening or just before going to bed.
Another informal greeting is Grüß dich, literally '(I) greet you'. You'll hear this phrase used mostly among younger speakers. You may also come across regional variations on these greetings. In parts of Austria and Southern Germany Grüß Gott, literally 'greet God', is used to say hello. However, if you're in any doubt, you could always opt for Hallo, hello or hi.
For saying goodbye there are equally varied forms you can use, depending on who you are speaking to. In formal situations you should always use Auf Wiedersehen, Goodbye, or literally 'until we see each other again'. Among friends or in informal settings you can use Bis bald, See you soon, or Tschüs, Bye or See you.
In keeping with this attention to formality, Germans are sticklers for titles. When speaking to someone you don't know as a friend, always use their title and their last name e.g. Herr, Frau, Dr Schmidt, Mr, Mrs or Dr Smith. If in doubt, start with a more formal address and take your lead from the person you're talking to.