Be confident. First, of course, you must have a reason. Therefore be competent. Learn roadcraft. Know what works.
Motorists aren't actually trying to kill you. They just want to get past you. While you do not have to accept marginalisation, recognise when it is in your interest. Using every opportunity to hold up a line of impatient drivers is no real victory.
[1] Choose your moments based on a calculation of risk heavily weighted in your favour. Don't get too worked up about 'primary' or 'secondary' position.
[2] It's completely down to local conditions, the variables being so complex as to confound even well meant attempts to codify a set of rules of behaviour.
[3]Obey traffic laws. It makes life easier for everybody. This does not mean you are required to pay greater heed to road furniture or paint than to your safety. One example is stop lines meant to give vehicles turning into the lane alongside you room to manoeuvre, but which may be holding you back from a position of visibility; as traffic engineers think mostly about cars, depending on the circumstances you might be able to ignore them.
Cultivate respect for other road users and pedestrians, even if you feel it won't be reciprocated. Respect can be contagious.
Be the first to show your hand. If you're cycling on a pavement/sidewalk - fine if you're not endangering anyone else, though not ideal
[4] for a number of reasons - slow down or dismount to give right of way and peace of mind to the main users of that space. On roads, cyclists are just as much the traffic as everything else out there, so your actions should be more predictable than selfless. While there's no need for obeisance, giving way, when possible, feels karmically good.
When faced with hostility, if you cannot turn the other cheek, turn away. Wrath targeted at air dissipates quickly.
Similarly,
learn how to forgive those who trespass against you. People make mistakes. Pounding on the sides of cars might equalise the pressure inside your head; getting pounded on yourself probably won't, if it comes to that.
This is not to say you can't show motorists the error of their ways. When doing so, it is natural to be flying high on righteous adrenalin or shaky anger. To avoid a bad scene, bring yourself down a notch before confronting the guilty party. You might be pleasantly surprised to find that they're sorry. It's been known to happen. If nothing else, you will make a better impression.
Consider iPod cycling if you're comfortable with it. Music is a mood enhancer par excellence, which must be one reason moralists target it. Earphones also offer excellent protection against road rage as it becomes easier for you to ignore provocation.
Zen riding is a state of mind, not of drivetrain. You do not need to be riding fixed wheel to achieve it.
Offroad,
don't let the bastards get you down. The press, that is.
[5] Until a majority of their readers are cyclists, you cannot expect much more than occasional pats on the back for being 'green', or indulgence for being eccentric.
[6]Smile once in awhile.[7] Staying alive is serious business, but it's not all hard work. Grimacing is a drag and not a great advertisement for cycling. Enjoy your freedom. If you're plugged in [see above], you might consider the lyrics of Bobby McFerrin: "When you worry your face will frown / that will bring everybody down." It couldn't hurt.
See also
Notes
1 - "They'll only save a few seconds" is a common refrain. Like it or not, time in a car is counted somewhat differently than it is on a bicycle. Seconds can seem like minutes. Not to mention that all those seconds add up. It's a wonder impatient motorists haven't gone gray by the end of their journey.
2 - Terminology familiar to anyone who has read John Franklin's Cyclecraft: Skilled Cycling Techniques for Adults. True believers would have this book in the panniers of every bicycle, like a Gideon's Bible. While there is excellent advice to be found between its covers, you are not required to swear on it in courtrooms (where the author can sometimes be found, giving his expertise on the subject). See A Proper Cyclist for an opinionated synopsis.
3 - Heretics and dreamers aim for the sweet spot in road positioning: where you stop motorists from passing when it's unsafe, but don't make them feel you're insulting them with your relative slowness.
4 - or legal in the UK.
5 - Silly Season is now all year round.
6 - Everybody likes an eccentric. Until they actually meet one.
7 - If it's not too bright-sided for you.