It depends on why you want to leave.. If it's reasons outside the game..illness, work etc..you could tell other players in the game...get them to pause the game.and request help from the Almighty Mods to get a replacement player..
If the reason (s) are within the game.. eg nobody will form an alliance with you then you have several choices ( not all of them necessarily have the approval of the powers that be )..play dead..just use hold orders ( not really approved of, but not, I think, against the rules ... Mods might advise on this point )
You could decide which of your Neighbours you dislike most and which you dislike least..you then play in such a way as to advantage the neighbour you dislike least, and to disadvantage the neighbour you dislike most.
Valis points out your obligations to the other players well and he is an Almighty Mod, so respect must be shown to his comments.
However this is a game where self interest is a strong feature, and this is traditionally interpreted as " you must do what is in the best interests of the nation you have in a game"
Another view might be that getting enjoyment is part of your self interest in playing, and if screwing the other players about to repay them for their treatment of you gives you a perverse form of enjoyment, then perhaps they deserve it, and you have a right to make them uncomfortable, and frustrated.
If you choose that path then you can expect to get some "message flak".
One thing to remember is what you choose to do will influence others view of you, and affect your reputation on this site.
It's perhaps the toughest test of your abilities as a " Diplomat" when the game situation is terrible, so I'd encourage you to consider that and your reputation when deciding how to proceed.
Bon chance, mon ami...and remember you cannot trust anyone except mad old MajorMitchell in a game ( ha ha )