Um. I don't by any means think it's random, but clearly the exact formula is unknown. No one can truly understand without an explanation from the devs or extensive testing. It was some time ago, but I DoW'd them in early 1445 and neither had been in a war, so their manpower and prestige must have been fairly close.
The easy solution would be to highlight the flags of allies who can potentially take over as warleader in the DoW menu. There's no real reason you should need to go to the ledger and make a comparison of several numbers on multiple pages to guess who will take over, if anyone.
Yes, something like this.