You have to consider the intended result, and how the effects interact with each other. A good example is a wah and a delay.
If the wah is in front of the delay, you play a note while moving the wah, you get a "pwah" sound, the delay hears the "pwah" and repeats it : "pwah pwah pwah pwah"
If the delay is in front of the wah, you play a note "ping", and the delay will repeat the clean note, " ping ping ping ping", and then you can use wah to affect that "ping pong pung poong pang"
I have no idea if that makes sense to anyone but me!
Things that generally should be first in line are dynamic processors like a noise gate or a compressor. If you put a reverb in front of a distortion pedal, the reverb is going to be distorted, too, but it might sound cool.