Rule #1: Don't
Oh how edgy, opening an internet rulebook where the first rule of something is you don't...something something something.
It's true though, don't argue. There are a lot of *ahem* "colorful" sayings about arguing on the internet that I won't bother to repeat here but something that comes to mind is:
Arguing on the internet is the verbal equivalent of knife fighting with bananas. No one wins, and you both end up looking stupid.
Keep in mind your goal in any internet engagement shouldn't be to "win" but to get people talking. Thinking. As soon as you start with the mindset of arguing, you've lost the ability to get people to do that. People don't think about WWF as a discourse in fighting, they see it as entertainment. Likewise, arguments online can be fun to read/watch but they rarely lead to people going home and mulling over what was read/said. Most of the times an argument will only serve to polarize. This is why politics is doomed because very few have taken the "Furby Course to Argumenting" although I have many subscribers to my, "Furby Course in Making Up Words."
Keep in mind that the goal of any disagreement isn't to win over the person you're arguing with, but to help someone else who has never thought about the topic at hand, or may be unsure, create an opinion. For the sake of your sanity just believe that you will not change the mind of the person you are debating with. There are, of course, exceptions to that rule but for the most part it isn't going to happen. If you get that goal out of your head, that there is no winning, it makes the rest of the rules infinitely easier to follow. It's not admitting defeat to say you won't win, it's shifting the goal line to a different location.
Rule #2: Emotion
The second you start getting upset, the debate is over. To engage in discussions, thick skin is required. A quick and dirty tactic people enjoy using online is to attempt to make you angry - to use personal attacks to rile you. It's cliché, but true that anger clouds judgment. It's hard to make a compelling case for something if you're defending/counterattacking personal attacks.
Be prepared to deal with these people. If the attack lends nothing to the actual discussion, ignore it. As tempting as it might be to send your own barbs back, it immediately derails your argument and makes you look just as bad as the troll who attacked you in the first place.
This is a difficult thing to master and it may help that if you're not at peak control of your emotions, not to engage in any arguments. Remember, at the end of the day, what's important is your own mental health and how that is going to affect your real world interactions. It's not fair to the people in your life if you're hostile towards them because of something someone said online.
Rule #3: Your Opener should be concise and contain the crux of your argument without added filler
Some people love to argue. I can think of one person at least that is notorious for arguing here on this ole' website. If you hadn't read that comment thread, I'd suggest skipping the first comment. For all the negativity inherent in that opening statement, the rest of the discussion is done quite well in a calm, civil manner.