One approach to problems like this is "multilevel" or "hierarchical" modeling: build a model for the individual students' scores which are nested within a model for the schools.
The problem you pose is actually very similar to the classic Bayesian problem for "the eight schools," which is discussed in Gelman's Bayesian Data Analysis: students in eight schools are coached on how to improve their test scores. The posterior distribution of effect sizes for the coaching for all eight schools are shrunk towards zero, whereas the non-hierarchical result (corresponding to no pooling across schools) provides the opposite results, partially owing to its unrealistic framing of the problem.
So, no, within the same school, it is unlikely that the students are i.i.d.-- the students likely have teachers in common and so forth, which creates some dependence among students. We can imagine that a class of students would not do well on an elementary math test if their teacher decided to skip the lessons on fractions, but otherwise covered the rest of the material. So you would have to build a model accounting for the dependence among these student-level observations.
Across the entire population of students, the same form of dependence must exist: if students in the same school or class are more similar than students in other schools or classes when looking at just two or three schools or classes, then this effect must be present in the whole nation, when you are looking at all of the schools, or all of the classes.
However, it's less clear whether this dependence is important in the particular context of some specific research question. This is because the effect of dependence on quantities of interest may be quite small, or because specific research designs mitigate this dependence.