And remember there are many ways to do it - yielding the quarters on the ground, leg yield, shoulder fore, 3x and 4x shoulder in - they are all versions of the same thing. The more familiar you get with them the more you get a sense of when to use which.
E.g. a 4x shoulder in can stop a horse running away and also prepares for a passage... .
A little shoulder-in aid without doing a full shoulder in, when done in the circle, rebalances the horse
A little shoulder in aid on the straight line straightens the horse
A shoulder fore in canter for a stride or two stops a horse hanging on your hand
A leg yield into a three track (3 xs) shoulder in takes the horse from long and low to uphill self-carriage when ridden
Yielding the quarters in hand helps get the center of gravity back before the horse is ridden
so basically the shoulder in engages the quarters (the engine) while lightening the forehand and brings the center of gravity back underneath the rider making the horse's energy available to the rider, not working against the rider...