It's all in the geometry, you are working in triangles. A drive shaft shop will have you do some simple measurements under the vehicle to figure it out. It helps to know how many inches the suspension can compress and extend from ride height (with all the weight on the vehicle). The ratio of compression/extension versus the total will tell you approximately how much of the working length of the yoke should be exposed at ride height.
Say you have 6" of compression and 10" of extension at ride height. Of the total compression is 6/16 or 3/8 of total travel. The extension would be 10/16 or 5/8 of total travel. If you have 2 inches of slip available you would set it at 3/8 x 2 or 3/4" away from bottoming out at ride height. You may want to hedge with a little more room for full bumpstop compression, because jacking your driveshaft into the t-case from a hard hit is bad ju-ju. It helps to know the working length of the slip-yoke, but I don't know that I have ever seen that measurement on any documentation I have ever read. That must be the drive shaft shop "magic".
Obviously, I have over simplified this because true hotchkiss leaf spring suspension or a typical link suspension locates the axle in an arc, my example above assumes travel in the vertical plane only.