If you've ever tried marching in a marching band, you know that it takes practice to move in unison. Even to march down a few blocks of straight road takes practice. Complicated moves and turns take more practice. Learning to move in a synchronized pattern is a complicated business. It's not easy.
Fish swimming in a school are doing moves similar to what a marching band does, but their moves are even more complicated. They have to work out their up and down movement through the depth of the water, and they often swim in schools of thousands.
How do they do it?
Fish primarily use two of their senses to swim in unison with their school. They depend on their sense of sight and a sense known as their lateral line.
Fish have an excellent sense of sight, but they see differently than we do. With one eye on each side of their bodies, fish can constantly be checking and making tiny adjustments to their distance from the other fish on both sides.