For lads its a kind of asserting male power thing. The idea of being able to score sexually, with a woman who is older, and supposed to be in a position of power, is a real turn on, it feels like an ultimate statement of masculinity...yes you're my teacher, but I'm still male and you're female, you want me and I can make you do things to me.
For girls I would guess its more a kind of looking up to authority and maturity, and also a reaction to females being more mature than their male peers. If you get the more intellectual teenage girl, who is into literature and so on, and is awaiting her first sexual experiences, she is going to be both nervous and curious about them but also will probably have romanticised ideas of relationships. She will have boys her own age coming at her with advances on text/facebook like "yo babes i wanna finger ur pussy lol" and will probably be unenthusiastic, but she can fantasise about her 30 year old male teacher, who is well mannered, familiar with the same type of literature that she is, has a reasonable disposable income and could probably take her out on proper dates and make her feel like a woman. Even though she knows it can't happen, in her head she likes the idea. In the end she will come back to reality and lose her virginity to a semi-literate chav at a house party when she's drunk, and from then on her life will be constantly about re-evaluating her expectations. Downwards.