Based on the above comment of Holger Partsch, you can't factor a lot of stuff. You can do silly things like:
A necessary condition for factoring $f$ through a given $S'$ is that you can embed: $$K(S) \subseteq K(S') \subseteq K(X).$$
If you are willing to blow-up $X$ to resolve indeterminacies, then this might be the only obstruction in the geometric setting anyway (assuming $S$ and $S'$ are normal).
On the other hand THIS question, and the numerous excellent answers, seems like it might be very relevant depending on your context.