This is a good debate for us, and I hope someone other than the three of us reads it!
There are fish whose lifestyle is solitary. They hold territories, hate all visitors and only connect with their own species for breeding. They are awful aquarium residents, unless you want one fish in a large tank. Usually, they inhabit caves or lie low. The only really popular ones are the red tailed and rainbow 'sharks'.
There are station keepers. Betta splendens comes to mind. They hold a spot , feed there, and hope to nest there. They'll fight off fish that intrude. Wild Bettas live in wild population densities, with males eyeing each other but carefully avoiding challenges.
Schooling tends to be a fear response. A threatened fish seeks cover in its own, to confuse predators. If you wonder why you don't see schooling in your tanks, it's because your fish don't live in fear.
Shoalers take many forms. My killies can live in large groups, as long as I never have only 2 males together. My cardinals are lost in small groups. It varies. Every species has evolved differently. We want to simplify it, but.
Here's one of our real oversimplifications - African Cichlids. In one lake, Lake Malawi, in the vast and rich continent of Africa, there is a lineage of Cichlids that have evolved a need to live in crowds. In the many other lakes and rivers of the continent, fish hold large territories, often in pairs or pairs with juveniles around and would be in abject misery crowded. So what does the hobby do? They're from Africa. Crowd them.
The number issue is a problem. With understanding, the numbers we need keep growing. It was 6. Now we see problems with 6, as
@Byron has detailed. So 10 has become an arbitrary number. One of my friends has described cardinal tetra and Corydoras migrations to me. The cardinals were in the millions. The Corys in the tens of thousands. But when the Corys get to their destinations, there are sources galore that say they break up into little groups of 6 to 8. They forage in manageable groups, but may group together at night. Not a lot of divers go in at night to find out.
I think 10 is a number we have pulled out of our... well, we decided just like that. I'll risk sounding cruel and say the best number is the most you can get and care for. I seem to be buying 4 Corydoras arcuatus tomorrow, because that's all the seller has left. A low number? Yup. So I will do my best to breed them, and get a decent shoal going for them. I can't conjure them up. With a lot of other fish, I can't afford big groups.
But if I lack space for a big group, I don't buy. I may have to build a population, but I try to never crowd one.