Schooling and shoaling is a kind of collective animal behaviour by fish.

Any group of fish that stays together for social reasons is said to be shoaling, and if the shoal is swimming in the same direction together, it is schooling.p365 About one quarter of fish shoal all their lives, and about one half of fish shoal for part of their lives.

Fish get many benefits from shoaling. These include defence against predators: if fish swim in schools, it is less likely any one of them will be eaten. Also, it may help a fish find food, and a mate. The school may even swim faster than a lone fish.

Fish generally prefer larger shoals, shoalmates of their own species, shoalmates similar in size and appearance to themselves, healthy fish, and kin (when recognized).

Any shoal member which stands out in appearance may be targeted by predators. This may explain why fish prefer to shoal with individuals that resemble themselves. This is called the oddity effect.

Schooling 

Some fish spend most of their time schooling. Tuna, herring and anchovy, spend all of their time shoaling or schooling, and become agitated if separated from the group. Others, such as Atlantic cod, school only some of the time.

Shoaling fish can shift into a disciplined and coordinated school, then shift back to an amorphous shoal within seconds. Such shifts are triggered by changes of activity from feeding, resting, travelling or avoiding predators.

When schooling fish stop to feed, they break ranks and become shoals. Shoals are more vulnerable to predator attack. The shape a shoal or school takes depends on the type of fish and what the fish are doing. Schools that are travelling can form long thin lines, or squares or ovals or amoeboid shapes. Fast moving schools usually form a wedge shape, while shoals that are feeding tend to become circular.

Small fish are preyed on by larger fish, seabirds and marine mammals (Cetacea). Small fish form schools, and may swim with their mouths open to filter feed on plankton. These schools can become huge, moving along coastlines and migrating across open oceans. The shoals are concentrated fuel resources for the great marine predators.

These immense gatherings fuel the ocean food web. Most forage fish are pelagic fish, which means they form their schools in open water, and not on or near the bottom (demersal fish). The predators are keenly focused on the shoals, acutely aware of their numbers and whereabouts, and make migrations themselves, often in schools of their own, that can span thousands of miles to connect with, or stay connected with them.

Herring are among the more spectacular schooling fish. They aggregate together in huge numbers. The largest schools are often formed during migrations by merging with smaller schools. “Chains” of mullet schools one hundred kilometres long have been seen migrating in the Caspian Sea. Radakov estimated herring schools in the North Atlantic can occupy up to 4.8 cubic kilometres with fish densities between 0.5 and 1.0 fish/cubic metre. That is about three billion fish in one school. These schools move along coastlines and cross the open oceans. Herring schools have very precise arrangements which allow the school to maintain relatively constant cruising speeds. Herrings have excellent hearing, and their schools react very fast to a predator. The herrings keep a certain distance from a moving scuba diver or cruising predator like a killer whale, forming a space which looks like a doughnut from a spotter plane.

Many species of large predatory fish also school, including many highly migratory fish, such as tuna and some ocean going sharks. Cetaceans such as dolphins, porpoises and whales, operate in organised social groups called pods.

Schooling behaviour is generally described as a trade-off between the anti-predator benefits and the costs of increased competition for food.

Schooling is a classic example of 'emergence', where there are properties that are possessed by the school but not by the individual fish. Emergent properties give an evolutionary advantage to members of the school which non-members do not receive.

Predator avoidance

Fish are in danger of being eaten if they are separated from the school. Several anti-predator functions of fish schools have been proposed.
 Confusion effect – One potential method by which fish schools may thwart predators is the ‘predator confusion effect’ proposed and demonstrated by Milinksi and Heller (1978). It becomes difficult for predators to pick out individual prey from groups: the moving targets create an overload of the predator's brain. "Shoaling fish are the same size and silvery, so it is difficult for a visually oriented predator to pick an individual out of a mass of twisting, flashing fish and then have enough time to grab its prey before it disappears into the shoal".
 Many eyes effect – A second potential anti-predator effect of animal aggregations is the ‘many eyes’ hypothesis. This theory states that as the size of the group increases, the task of scanning the environment for predators can be spread out over many individuals. Not only does this effect provide the group with good warning, it may allow more time for individual feeding.
 Dilution effect – A third hypothesis for an anti-predatory effect of fish schools is the ‘encounter dilution’ effect. The dilution effect is an elaboration of safety in numbers, and interacts with the confusion effect. A given predator attack will eat a smaller proportion of a large shoal than a small shoal. Hamilton proposed that animals aggregate because of a “selfish” avoidance of a predator and was thus a form of cover-seeking. Another formulation of the theory was given by Turner and Pitcher and was viewed as a combination of detection and attack probabilities.

Schooling forage fish are subject to constant attacks by predators. An example is the attacks that take place during the African sardine run. The African sardine run is a spectacular migration by millions of silvery sardines along the southern coastline of Africa. In terms of biomass, the sardine run could rival East Africa's great wildebeest migration.

Sardines have a short life-cycle, living only two or three years. Adult sardines, about two years old, mass on the Agulhas Bank where they spawn during spring and summer, releasing tens of thousands of eggs into the water. The adult sardines then make their way in hundreds of shoals towards the sub-tropical waters of the Indian Ocean. A larger shoal might be 7 kilometres (4 mi) long, 1.5 kilometres (1 mi) wide and 30 meters (100 ft) deep. Huge numbers of sharks, dolphins, tuna, sailfish, Cape fur seals and even killer whales congregate and follow the shoals, creating a feeding frenzy along the coastline.

When threatened, sardines instinctively group together and create massive bait balls. Bait balls can be up to 20 meters (70 ft) in diameter. They are short lived, seldom lasting longer than 20 minutes.

The fish eggs, left behind at the Agulhas Banks, drift north west with the current into waters off the west coast, where the larvae develop into juvenile fish. When they are old enough, they aggregate into dense shoals and migrate southwards, returning to the Agulhas banks in order to restart the cycle.

References 

Fish
Ethology