The deciding factors are:
1. Tapered or straight steerer depending on your steering head tube. You can put a straight steerer in a tapered frame, but not the other way round.
2. Wheel size
3. Length of travel depending on what sort of riding you do. 100mm is fine for commuting.
4. Length of steerer tube. Needs to be long enough to go through your head tube with enough left to fit the stem and spacers. On new forks, you normally have to cut down the length. Used ones will have already been cut down so can be too short if you have a longer head tube.
5. Axle type: Q/R or through axle. Through axles come in different sizes too.