The manual explains it pretty good. Says that the 'random number' generated is based on levels up the HQ chain, overloading, range, and leader skill
Up the chain of command, each unit checks its next HQ in the chain for each 'check' needed. So there is more then one chance to pass a check, but for every check that is passed on the first check, the second check is a 'wasted resource', since even if good leader or close to combat, when the first check passes it is not used.
(range to HQ has an effect, but it adds range/1 for xxx, range/2 for xxxx, range/3 for xxxxx, range/4 for HC. However if there is +40 because it is the third check up the chain of command, the +40 is much more significant then range.)
A number is generated that must be below the leaders value for a category.
The first HQ a unit checks has +10, and +overload number based on CP limits +range
then if that fails it checks next HQ up the chain at 20 + overload number +range
Then if that fails it checks next HQ up the chain at 40 + overload number +range
(range has less effect on each rank of HQ)
So although CP effects checks, it has a larger effect on units that are overloaded in there first HQ, Up the chain of command checks are less effected by overloading as a ratio of numbers used in the formula.
If a 3rd level HQ(+40) is overloaded by 50(range0) Then a number is generated between 0 and 90(instead of 0 to 40) and it must be below 'leader value'
If a 1st level HQ(+10) is overloaded by 50 the number is 0 to 60(instead of 0 to 10). Overloading the first connected HQ by the same amount has much more of a negative effect.
It is really an interesting formula.
If there are enough Corps HQs, and you keep them under CP limit, you will get one check that will give best chance of passing, if that Corps is +5 over CP(5 range), the effect for that first check goes from 15 (+10 from first HQ, + distance) to 20. That means over CP effect of +5 if you have a 8 leader value, that check goes from 15(50%) to 20(40%). Thats from 50% chance, to 40% chance. Not really that bad. Although that is the exact same effect as if you keep your HQ 5 hexes closer to the unit. (or xxxx 10 hexes closer.)
Then the next check, it is already at +20 from the doubling, so that being 5cp over, not as big of an effect.
So the formula says. Keep HQ close, and for each level in the chain, if you are going to overload, the overload (cp number) should double each level, for the same effect cp overloading has on the 'chance as a percent' for each HQ
If you overload a corps +5, that has the same effect (on 'the die roll' as a percent chance to pass), as if you overloaded the next level Army by +10, since the corps would go from +10 to +15, and the army would go from +20 to +30.
Although the best idea is keeping the HQ close to the units as much as the CP. Each hex away a Corps HQ is away from a unit is equal to 1 cp overload. (For an army, the doubling means that 2CP over has same effect as a percent as the distance/2 as used for Army, so the percent formula is the same, again each point over cp for corpse has the same effect as 2 cp overload for Army because of the doubling.)
(cp overload of 1 is shown as -1cp in leader info screen if you want to check cp levels)
For 1st level corps, and second level army checks, 'CP overload' is equal in penalty to '1 more hex distance'. (For the third level, the hex distance is /3 while the CP as a ratio to the doubling(40) is *4, so cp means more in the third level then range.)
Conclusion, keep your armies and Corps HQ close, then decide if you want one better roll and one worse, or two chances about the same. (sending support units to the battle also is effected by cp I think, so I keep corps at 8, then overload the army a bit.
Then on top of that, a leader of 9 and a leader of 8, is one point difference, same difference the CP adds or one more range factor adds, so I concluded better leaders in corps is more important.
One more thing
And since you lose 10% when mixing units of different corpse, and loss of 20% for different armies for CV, that means more then CP also. If the first check is cp overload +4 + 10 +range 5 = 17. And that keeps units in same HQ avoiding the 20% penalty, and being part of a distant HQ, it could have better effects. (although not all checks are CV only checks, but it is something to consider)
This is all from memory after reading the rules, and could be completely wrong, or missing some factors
Because second checks never occur if first check passes, the best situation should be in the first check, so best leaders, closest units, and non CP overloaded HQs as first level, that is what I figured. If units have to be spread out, like a fortification line, and have to overload significantly, such as a German Fortification line, then attaching those directly to a higher level HQ that has less range penalty is a good idea, to avoid penalizing other units in corps and armies, so defensive lines I attach to HC(no overload penalty), or possibly a front command that is not cp overloaded.