Mostly luck. If nobody brings it into school it can't spread.
My school has had zero cases among children, teachers or support staff all term.
In our last staff meeting of term the head congratulated us and said, 'I'm sure there is luck involved but it's also down to all of you following our excellent covid practices so well.' I almost spat my drink out all over the computer screen and was very glad my camera and mic were off. Because our so called Covid practices are shit!
Hand sanitiser is everywhere. But half the children avoid it and pretend to use it whenever they think they can get away with it.
Our windows open and we can override the safety catches to open them wide but we were told that if the classroom gets too cold we can close them if we like.
We have a one way system but the children (and staff in far too many cases) ignore it at least half the time.
Our 'bubbles' consist of 2 year groups each (Oh, except in the dining hall when it's 3 year groups and during enrichment activities when it's 4 year groups and in the boarding house when it's 6 year groups ...) 
We have had three whole school gatherings (outside) this term and several smaller but cross bubble gatherings.
Our older children and staff wear masks in communal areas but we're rarely in communal areas and most remove them in the classroom.
Our children (even the older ones) do all practical subjects almost as normal, including group work and singing. We were hot on adaptations in Sept (i taught outside for the first month, for example) but it slipped badly as time went on and we had no cases.
We even had a short staff Christmas 'gathering' at the end of term 
There is no way our lack of cases is down to anything but luck. All term I have been reading about cold, lonely, miserable overworked staff whose schools are still overrun with cases. While we carried on our memory way having a nearly normal term with no consequences whatsoever. Just luck.