How to do it? Have the courage to sit down and talk with your spouse/partner what you are thinking and why. GIve them the courtesy of a face-to-face talk. Yes, there will likely be tears. Yes, it will be uncomfortable for both of you. Still you owe this to the person with whom you have been intimate.
Most of my clients want to end their marriage/relationship with dignity and at the lowest cost possible. How you tell your spouse/partner sets the stage for whether this is possible.
What if you just cannot have that talk because you fear that your partner's/spouse's reaction will be to negative for you to handle. Get help. See a therapist and review options on how to approach the subject with the counselor. Consider having the talk with the therapist present. Look at the local collaborative practice website, such as www.collaborativepractice.mi.org for the names and phone numbers of divorce coaches.
How not to tell your spouse:
a) text them and leave for a two week vacation during which they cannot reach you.
b) have a process server waiting at the school when your spouse is picking up your children. Your children should not witness your spouse's disappointment/anger.
c) serve your spouse at work or while she is volunteering. Humiliation in front of friends and co-workers gets the case off to a really bad start.
d) clean out the house while your spouse is away and remove your items.
Using indirect communication to tell your spouse such important news is going to destroy the trust that you need to complete your divorce with dignity and civility. Unless you need to get out of your home using stealth to protect your safety, use direct communication.