"SAN" is similar to "Mr", "Ms.", "Mrs", and so on, meanwhile "KUN" is informal and mostly used for males, such as boys or juniors at work
Sensei is used to refer to or address teachers, doctors, etc... and Senpai is used by students to refer to or address senior students in an academic or other learning environment