Capturing the enemy king is a fun way to end a war. In one of my games I was invading England as Ireland to press my claim on the throne, hoping their war with France would keep them busy (I also called in Scotland as an ally). All was going well, with me rolling across England claiming county after county, until suddenly the war with France is over and here comes a 25k army and a 5k army right behind it. I had 10k men left all total, split up in a bunch of smaller groups, after all the castle capturing (lots of "you lose 5% of your guys" events add up quick). But I noticed that the King of England was leading the 5k army. I used my boats to quickly pick up all my scattered forces before the 25k group stomped them, then put them all together and rushed the 5k army while the 25k one was busy retaking one of their castles. I then proceeded to beat that army into submission repeatedly, chasing it across several counties, until I finally got pinned into one last fight with the 25k army moving in on top of me.
Last minute I finished off the 5k army, killing them to the last man, and capturing the King. The very next day the 25k army arrived, hopelessly outnumbering my remaining 7k men - but since I had the king I just forced his surrender and presto, England is under new management. Plus I have the biggest threat to my throne still locked away in prison, since not only does he absolutely hate me but he's now the biggest duke of England, holding 4 duchies and a whole bunch of counties. The funny thing is, his heir absolutely loves me since we share a bunch of traits (and he's content too) - so when the father inevitably bumps off from the prison time (he's already 55 and wounded, so he shouldn't last long) I should have a nice loyal duke even if he does have claims on the throne, and the claims will probably die off with him as long as he stays content and doesn't try to use them.
It can also go the other way though. In another game I was fighting a holy war for one of the Muslim owned duchies in Spain and one of their friends who jumped in the war suddenly showed up by boat with 15k men and beat up my 10k stack (I had another 20k troops spread out taking castles, but they couldn't arrive in time) and they captured my king as the men retreated. Not only did it make me lose the war, they had my king executed.