I believe it's mainly in doing with how well your cohort performed in the internal and external exams.
The rank gets recalculated for each year
I think my school was ranked at 66 during 2012 and dropped to over 100 or 200 in 2014. Better-ranked school generally have better teachers/ students/ materials compared to poorly ranked school so that students can achieve better in the actual assessments and exams.