It happens more than you think - just not in books. An infographic crossed me desk this morning which lists famous schools from fiction, including Hogwarts, Crunchem Hall, and Forks High.
The graphic is regrettably biased towards schools shown in movies and tv shows, but that is not a sign of a poorly made graphic. No, I think it reflects that schools aren't used in books as a setting nearly as often as you might think. I found a wikia focused on fictional schools, and from what I can see movies and tv shows are much more likely to be set in a school (it's an ideal setting for a horror movie like The Breakfast Club, for example).
Books, on the other hand, tend to focus more on what a kid might do outside of school than in. That's an interesting contrast, isn't it?
Is there a fictional school that you think should have been included?