The previous poster has the thrust of the answer.
There is a bunch of limitations, all of which must be satisfied simultaneously to determine the RTOW for the day. Functionally, this means that the usual approach is to run all the calculations and whichever gives the lowest weight becomes the RTOW.
Clearly, a particular runway may be simplified on the basis of prior knowledge excluding some of these calculations but the generic approach is the answer you seek.