I'm probably the last person who would tell you to leave. But being in a relationship with someone who has bipolar disorder can be insanely rough, fair warning. I know, my wife has bipolar--it can get more complicated for us though, as I have schizophrenia. And yes, like you said, the good times are simply amazing. Anyway.
You're going to have to be able to stand with him through all the rough times--it's good that he's going to see a doc, though, bipolar can respond well to a combination of meds and therapy. You also may have to do some things you know are best for him, but you'll worry he'll hate you for, depending on how severe he gets.
As for how the meds work, any _good_ doc will tell you that no one really knows the answer to that. The theory is (assuming he is bipolar) that the balance of certain neurotransmitters in his brain is off, and the meds change that balance. Unfortunately, any given med can have quite a bit of variation from one person to another in terms of its effectiveness (and potential side effects), so there's likely to be a certain amount of trial and error involved in finding the right med(s) for someone. Certain meds don't play nice with others, either, so it's important for the doc to be aware of any other med, even herbal supplements. Meds can also take a while to reach full effectiveness, and they don't stop everything, no matter how well they work.
Note on his previous xanax addiction--he should probably avoid other drugs in that class also: benzodiazapenes. If you're worried about him not telling the doc about the xanax, find out what he does get prescribed, and contact the doctor's office with the truth if it turns out to be a benzo (you'd probably have to look it up drugs.com is a good starting place). Actually, I think you should call the doc before the appointment, but maybe that's just me.
Your boyfriend's anger could easily be part of his manic episodes, by the way.
I'd also suggest looking around the net some for some support sites, there's quite a few. given your situation, you might have a look at Life, Love, and Bipolar.
Bah, I had more to say, but I've run out of time. I'll check back.