This is one of the challenges the game has to offer and you’ve got to try your best to plan for this. A few suggestions based on how I handled succession:
1. Try and leave a large pot of gold leftover for mercs and gifts
2. Use your children and siblings for strategic alliances. You don’t need to ally everyone, just the most powerful and dangerous vassals (so if your current ruler has excess children, leave some unmarried for the coming ruler to marry off their siblings)
3. In the early reign the council really needs to be populated by the powerful vassals in order to prevent and obvious negative opinion modifier
4. Sway, befriend, sway
5. Imprison criminals when possible
6. Be strategic, sometimes you can give in to a liberty faction and peasant faction in order to avoid a war
7. If war is inevitable, sometimes it’s best to trigger the war early before more vassals join up. Find the war leader, and take their capital (if it’s close) or siege down all the close vassals and knock them out of the war.
I hope some of these strategies help! Other long term solutions are making sure your domain is strong and built up. A strong domain, good alliances, and a few friends and family in the right place will do the work.