The front and back of the school is the most dangerous spot - since it is the most exposed to predators. However, anchovies share this responsibility of being in the most dangerous spot by following two simple rules.
Rule 1. When you get to the front of the school, slow down to a speed slower than the school.
Rule 2. When you get to the back of the school, match the speed of the school.
Following these two rules means that the anchovies will constantly rotate between all the varying degrees of safety of the school, a problem that would be difficult to orchestrate from an outside perspective, but one that is easy for the anchovies to figure out for themselves.