Should I write an email to the professor I want to work with regarding my performance in the exam? I am a masters student in one of the Swiss federal institutes. There is a professor I wish to work under as a PhD student after my masters. In fact, this was the entire reason I decided to join the masters program in this institute. After coming here, I did a semester-long project with this professor and took a course under the professor.

I think I did well in the project. Although I did not do anything original, I read a lot of difficult things and made a nice report. I asked the professor if there is a research position that I can apply to and continue working for the coming semester (it is very rare to get research positions in pure mathematics as a student) and I was told that it may be possible and more will be informed in a week.

However, this week the final exam of the course that I had taken under this professor was scheduled and I am not too hopeful about the performance in the exam (I think it was mostly because I spent too much time in the project and spent less time in my coursework). This professor is famous and can easily get students more capable than me.

Do you think I should write an email to the professor apologizing and explaining about this? What should I say?
From your explanation I assume that you are very keen to work with him/her in future as a PhD student. So you were trying to your best to do very good in his/her paper. How about your project work? I assume that it was appreciated by your professor, but doesn't matter.

To answer your question, you can always write emails to him/her mentioning about the project work and future advice. So if you write emails, then forget about the exam results and no need to mention about the performance of this exam in your email.

I would prefer to take an appointment after the exam and meet him to discuss about my interest to work with him as a PhD student.