Why are the protagonists generally seated by the window? I've noticed that in some anime the protagonist is seated by the window in the classroom. More specifically, the protagonist is generally on the second seat from the back (or sometimes on the very last seat).
I don't know if this happens in every anime, but it seems to happen on at least some.  

 
 
Top: Tomoko from Watamote (left), Touma from Index (right). Bottom: Light from Death Note (left), Tenma from School Rumble (right).

Why does this happen?
Does it have something to do with character conception or mood setting?
Is it a plot device or something else?
While backbenchers are common throughout the world, windows seats are similarly favoured by just about everybody in most situations. People want and prefer window seats be they in classrooms, trains, or aeroplanes. In anime, these seats additionally facilitate a few things (some of which have been covered in other answers):


The character can look out of the window to act bored.
The character can look out of the window to see other characters outside.
The character can easily exit the classroom by way of the window.
The character can easily enter the classroom by way of the window.
It reduces some of the artwork. When focussing on the character, the artist will not need to bother drawing and animating additional characters on either side. He can simply focus on the main character and draw a window or a wall as background. This saves time and money.


That said, I think that there's a mild case of confirmation bias in the question. There are plenty of anime where the protagonist is not seated by the window. Offhand, I can name Makunouchi Ippo in Hajime no Ippo, most characters in Lucky Star, the characters in Hidamari Sketch, and so on.