Schooling

Fish often school, or swim together, in large groups. Schools of fish may be polarized, with all the fish swimming in the same direction, or non-polarized, with fish swimming in many directions. Both types of schools improve an individual fish’s chance of survival. A large school of fish may be able to confuse a predator into thinking that it is one big, dangerous organism instead of a group of small, helpless fish. In addition, if a fish is in a school, it stands a good chance of being spared when a predator does attack. Plus, a school of fish has more lookouts than one fish swimming alone, and is more likely to notice danger.

Schools of fish
Schools of fish - Butterflyfish

Some kinds of fish, such as groupers, only form schools when it is time to spawn. This strategy ensures that the males and females will release their gametes into the water at the same time. If egg predators are nearby, they will eat some of the eggs but may not be able to eat all of them, so some will probably survive. Foraging for food can also bring a group of fish together. As a school, foraging fish like mackerel and herring have plenty of sets of eyes that improve the chances of finding something to eat. By working as a team, the school may be able to overwhelm and take prey that one fish alone could not handle.