It is a formal way to say goodbye to a teacher, often used by students.
You can also say:
* 再见 (zai jian): This is a general goodbye, suitable for both formal and informal situations.
* 老师您好 (lao shi nin hao): This is a respectful greeting to the teacher, used when you are leaving their presence.