I understand that fish don't think and that humans have the fault of trying to overlay their feelings and thoughts on everything around them.
Animals, including fish, learn by repetition and by instinct. We as animals also learn this way. eg: if you put your hand on a hot stove once you are not likely to do it again. That is instinct; there is no thought at the time of the action, it's only afterwards do we think how dumb that was.
As far as fish go, how do they "learn" that some things are edible and some things are not? Thet also learn that if they swallow a baitfish tail first they will be in trouble. Most of what they "know" comes from instinct. A "school" of fish is only a bunch of fish.