Schooling is a social behavior in which fish align and stay close to one another as members of a group.  Many animals live in groups, but unlike most such groups (herds of deer, for example) a school of fish has a consistent geometric orientation. Fish in a school swim parallel to each other, are evenly spaced, and move in almost perfect synchronization. Seen in this way, a school of fish can resemble a single fluid organism. This geometric synchronization distinguishes schooling from another common behavior, shoaling, in which fish loosely group together; however, the two are often used interchangeably.
Which Fish School
Schooling behavior occurs in both saltwater and freshwater environments. Schooling tendencies vary from species to species. Some fish spend their entire lives in schools, some school occasionally, some only shoal , and a few species neither school nor shoal. Schooling tendencies also vary by situation: individuals that show little interest in joining a school are much more likely to school when exposed to a predator or to a chemical alarm signal.  Some fish form short-term schools for spawning (reproductive) and migratory events.  Fish often form schools in order to forage more effectively over long distances; and predatory fish (such as sharks and barracudas) occasionally hunt in groups. 
Structure of Fish Schools
Schooling fish begin to form schools soon after hatching.  Schooling behavior seems to be limited by fry size: fry under a certain size or level of development will not school. As fry grow larger, they become more and more inclined to follow other fry for longer periods of time, eventually forming parallel groups swimming in tandem.
Most fish schools are intragenerational, even in fish that school or shoal only occasionally. The reason for this is that fish prefer to swim with fish of a similar size and that swim at a similar speed; size and speed being linked to age in fish.   Fish have a reason for preferring homogenous schools: predators are more likely to prey on a fish that "sticks out" from the rest of the group.  For the same reason, fish also tend to school with fish of the same species; but a small fish will choose to school with small fish of a different species rather than large fish of the same species. Another reason for fish to avoid schooling with fish larger than themselves is that larger fish can out-compete smaller fish when foraging.
In general, fish prefer larger schools to smaller schools. Larger schools react more quickly to predators, and tend to be more stable.  Predators are also more confused when attacking larger schools: as long as the school remains intact, predators will focus first on one individual, then another, etc.  Predators have lower rates of capture when they attack large schools or shoals than when they attack smaller groups of fish. 
However, competition for resources prevents schools from growing too large. When foraging, fish will split up into smaller groups if food sources are scattered. Schools that are too large also tend to fractionate due to internal dynamics: fish picking up on different environmental factors are less willing to compromise, and communication tends to be stunted in too-massive groups.
Relative positions within a school are determined by both social dynamics and environmental factors, and fish often change positions in the school in response to internal or external stimuli.  Fish exhibit a relative preference for positions at the front of the school when deprived of food: although fish at the front of the school are more likely to be attacked by predators, they also have an advantage when foraging for food.  However, when fish are alerted to the presence of a predator they are more likely to gather to the center of the school, where they are less likely to be caught by predators.
Why Fish School
There are numerous different reasons for fish to school. The first, and most common, is predator avoidance. Predators have difficulty tracking the movement of a single fish in a large school, so schooling fish have a decreased vulnerability to predators.  Schooling also offers fish a better warning system for predators and dangerous environmental conditions: chemical signaling, sound, vibrations, and the reactions of other fish within a school allow an individual to recognize a predator and react much more quickly than a lone fish could.
Of course, marine and aquatic predators have adapted to schooling behavior in prey fishes. Certain predatory fish select for schooling behavior when searching for prey, since many common prey species school.  And some predators have developed specialized hunting strategies for large schools: swordfish and marlin will strike indiscriminately into the center of large schools, and dolphins and whales have been observed "herding" and surrounding schools of fish.  Seabirds that attack from above tend to prefer larger schools of fish, because they are easier to spot from the air. 
However, many of these marine predators school themselves. Predatory fish, such as barracuda and sharks, sometimes hunt in groups.  Even non-predatory fish often school specifically to find food. Fish forage and find food more effectively in a group: it's easier for a large school to find food scattered over large distances, and information sharing can help fish determine the best locations for food.  In one experiment, fish were released into a tank that was lit only on one side. Shocked fish tend to stay in dark areas, but food was distributed on the light side of the tank at certain times of day. When new fish were added to the tank, they learned to move out of shady area at feeding times, even though no food was distributed. 
Another possible reason for fish to school is hydrodynamics. Opinions vary on the extent to which fish schooling affects hydrodynamics and swimming efficiency, but schooling can make it easier for fish to change directions more quickly and find their way through crowded or highly variable environments. 
How Fish School
Fish join and stay in schools by using predominantly visual cues.  Along with eyesight,fish also have a sensory organ, called the Lateral Line System, which allows them to sense vibrations in the water,and it is likely that they also use this sense to coordinate their movements in a school. A few species of fish are able to school while blinded by using only the lateral line system, but this has been observed in laboratory settings only and would probably not be possible in the wild. Fish also have a keenly developed sense of smell and use chemical signals in the water to transmit information, which is another method for finding and coordinating schools.
- Grunbaum, Daniel. 1998. “Schooling as a strategy for taxis in a noisy environment”. Evolutionary Ecology[Internet]. http://download.springer.com/static/pdf/768/art%253A10.1023%252FA%253A1006574607845.pdf?auth66=1393865989_f7f8646a3e3802005dc2b710fadb8179&ext=.pdf
- Shaw, Evelyn. 1962. “The Schooling of Fishes”. Scientific American[Internet].http://www.nature.com/scientificamerican/journal/v206/n6/pdf/scientificamerican0662-128.pdf
- Reebs, S. 2001.Fish Behavior in the Aquarium and in the Wild. Ithaca, N.Y.: Cornell University Press; 252 p.
- Brown C,Laland K,Krause J. 2006.Fish Cognition and Behavior. Oxford, U.K. Blackwell Publishing Ltd.; 328 p.
- Deloach, N. 1999.Reef Fish Behavior: Florida, Caribbean, Bahamas. Verona, Italy.: New World Publications, Inc.; 343 p.