First, I always start off with the assumption that I will keep all the fish I get. Second, I always assume that I'll have them until a natural death.
I determine the stocking and size based on three general requirements:
1) the fish has to be able to reach full size and approach a normal life span---this is the easiest step. I don't get fish that will out grow my tank nor do I plan to sell them, trade them or euthanize them
2) the fish has to at least exhibit normal swimming and feeding behavior----if I can't get this, I stop and either re-size the tank or change the species
3) the fish might be able to exhibit breeding, shoaling and interpersonal behavior---an amazing plus in my mind, and lately I've considered more desirable. I used to not do this.
To determine (1), I use the largest adult size that I can find it has attained in a tank, calculate the full bioload for all fish, and calculate the nitrate level with a weekly 50% WC using 50% protein food at a daily rate of 1.5% of body weight. If the nitrate PPM stays under 20, I assume I can achieve (1) from a health aspect. (The reason for this assumption is that my model has built in tolerances: a) most fish will not reach the absolute maximum, b) I can do more WC% per week and c) the adult maintenance rate is more like .75% of adult weight. So, lots of slack.)
To determine (2) is more complicated, as species differ a lot in this regard. Some species need wood, some need sand, some need large territories, some are peaceful only if given ample space, some are fast swimmer, some aren't flexible turners, some use the upper water column, some are too passive as eaters, some are nocturnal, etc. This is just a long process of examining a lot of components in a tank. Interior dimensions are certainly a large part, but so are tankmates, lighting, and decor for example. Larger tanks definitely help the chance of (2) occurring for swimming, but feeding takes more thought.
To determine (3) requires more considerations beyond (2). More space allows for more species members and certain decor might allow for breeding. More space also allows for more of one species and shoaling. Specific tank arrangements might allow for owner-pet interpersonal behavior like petting or hand feeding.