For conversation (it's almost the same for letters and Emails):
Using "Sie" is appropriate if you have a formal relationship to the other person, if the other person is older, in a higher position (e.g. your boss). It means you respect the other person.
If a person tells you only the last name you should use "Sie".
(I am a native german speaker and it's much harder for me to insult a person I address formally)
Using "Du" is appropriate if the other person is much younger (you would never say "Sie" to a child), if you are friends, or if you are related. You would also use "du" if you want a personal relationship, so if you are speaking with other students or girls (in your privat time, not in office) you are interested in, you should never use "sie".
If a person only tells you the first name, it is the same as offering "du".
(Formerly children were used to adress their parents formally, but that's a long time ago.)
"Knigge" is a book which answers many questions to good behaviour with other people. According to them, the person who is higher in hierarchy offers the "du" (source).
If you already used "du" and the professor didn't tell you to use "Sie", you should continue to use "du". If a person askes you to use "Sie" or "du", you should definitely do so.
Some of my personal experiences:
When I was in school in Bavaria, every teacher used "du" and every pupil "sie". Some of my former teachers offered the "du" after I got my final exam, but it were always the younger teachers. Every teacher asked us if it is still okay if they continue using "du" after we attained full age.
While I was doing community service (every German has to do either community service or military service) I used "sie" for all of my co-workers, as I was 20 and all of them were at least 30 and they had much more experience in the work than I had. All of them offered me to use "du" on my first day, except the boss. She was very young, but her position was higher. I guess she didn't offer me "du" as she had to tell me if I did something wrong and it's easier to do this on a formal basis.
I recently experienced that members of different political parties are used to a different behaviour. If you are on a meeting of the SPD it is very likely that they use "du". If you are on a meeting of the CDU it is very likely that they use "Sie".
A friend of mine who has a very good feeling for beeing politely uses "Sie" when she speaks with other students she works with. I was quite surprised as I would never use "Sie" if I spoke to other students in roughly the same age.
In the Internet (forum, Wikipedia, Social networks): As you don't know the real name of the person you will always use "du".