I just had the most messed up civil war happen: a duke demands that I abdicate (he has a 40% plot power). I say no, since I've defeated plenty of independence factions before, which is harder since I have to occupy the rebel territory. The rebels get a bonus army of around 15-20K troops. I raise all my troops to quell the uprising.
Then, in a chain reaction, the four rebelling dukes convince nine more dukes to join the rebellion, so that 13 out of my 22 dukes oppose me now. Moreover, a lot of my raised troops change allegiance so I can't gather my forces. I had 2300 gold in the treasury, so I hired 4500 Swiss mercs.
I win a lot of victories against smaller armies (1-4K), but the rebels are starting sieges in multiple counties. I focus on defending my duchies and preventing smaller armies from merging. Some neighboring states declare war on some rebelling dukes to take their territories.
I keep bleeding money due to mercs and baronies being conquered, until I'm down to around 1500 gold and war score -70%. I send my spymaster to the county the pretender duke is currently occupying, and the assassination chance of success is 30%, with a 32% chance of being discovered. I try six assassination attempts (250 gp each), but the duke survives and finds out twice.
My treasury is empty, so I dismiss my mercs and try to save some more gold. I win a few minor victories, defeating a 4500 stack, when the 12K doomstack notices me. I retreat to my capital, but the doomstack is in pursuit. I dismiss my levies, so bolster the defenses and save some more gold. Finally, I save 253 gp and try one more assassination...
... and fail again, being discovered for the third time. The war score is -80% and my personal counties are under siege. I can't raise my levies and have no money for mercs, so I surrender immediately, with the reply expected in 9 days.
Here's where things get weird. The duke is angry from the assassination attempts (-600 opinion penalty), so he tries to assassinate me, but I survive and my spymaster asks in an event whether to try to assassinate the duke in retaliation (for free). Figuring I have nothing to lose, I say "yes"... and the claimant duke is killed!
The rebels lose their cassus belli, and the civil war stops. This is how I won a war after surrendering.