I am not sure you really can rank the order of importance for these things...But I will try!
1. Capacity. Each tank has the capacity to hold only so many fish. Obviously, the mature size of the fish should be used to determine this. However, the SIZE of the fish isn't the key issue--it's the territory needs must be considered. I try and pick the larger of the two--if it's a huge fish but isn't territorial, then go by physical size. Small fish that claim huge territories should be in tanks where they can have enough space to be comfortable.
2. Physical parameters. This includes pH, temp, alkalinity, salinity, etc. Some values aren't important for FW, or for fish only systems. Lighting is important for plants and corals, not so much for fish and shrimp. It's always easier to find fish that go with what you have or that can adapt to your environment than it is to adapt your environment (with the exception of saltwater--mixes make it easy!).
3. Compatibility. The fish should get along. #1 helps with this, as does knowing the swimming preference and temperment of the fish. For example, african butterfly fish will eat small fish, but only those that hang out in it's swimming zone (the top), others will be ignored. So, small cories are safe, but guppies are not. Some fish do best in grups, others will fight with only their own kind or, own kind and gender, or own kind in mixed gender populations.
4. Feeding habits. Clearly, you shouldn't get a fish whose feeding habits you can't meet.