among the "many other factors" mentioned are the following:
the rule is only meant to apply to slim-bodied small fish, the kind of fish that grow to 3-4 inches max. For larger fatter fish or fish that are heavy poopers (like plecs) different rules apply
(basically, you can keep fewer and/or with extra filtration. It stands to reason that a 20 inch oscar has a lot more body mass than 20 neons, and is going to produce a lot more waste
it applies to tropicals only (coldwater fish need more oxygen, so more space)
some fish are highly territorial, so you may only be able to keep one of the same kind in the same tank
some fish needs lots of swimming space- it would be cruel to keep a 2 inch danio in a 2 gallon tank
in fact, the only fish you can keep in under 5 gallons is a betta
lots of fish are schooling, so you need to find the room for a whole school- or don't buy that species at all
other fish need special sex ratios
some fish have such special requirements that you may not be able to fit them in your tank
the rule is usually understood to be 1 fish inch/US gallon (3.8 ltrs/US gallon as opposed to 4.5 ltrs/UK gallon)
if the tank is very high=has little surface area, there may not be enough oxygen for that many fish even if filtration is adequate