Ironically, it's actually harder to measure the mass of the Milky Way than that of other galaxies. You'd think that with it being RIGHT THERE it would be easy, but alas. Most of the difficulty comes from (1) the galaxy spans a huge part of the sky, so it takes an extremely long time to observe any particular feature in detail across the whole thing (say mapping the strength of an emission line, for instance), and (2) it's hard to get an overall picture of the galaxy because parts of it get in the way of seeing other parts - there's a lot of dust in the galactic disk that obscures our view of the more distant parts of the disk, and the disk is where most of the stars are.
Stellar mass is actually the easiest mass to measure in astronomy, because you can see it much more directly than other mass components. All that needs to be done is measure the intrinsic (rather than apparent) luminosity of a galaxy, assume a "mass-to-light ratio" and multiply to get the stellar mass. Mass to light ratios are on the order of
$$\Upsilon\sim1{\rm M}_\odot/{\rm L}_\odot$$
So a galaxy with a luminosity a billion times solar has a stellar mass of about a billion solar masses. More accurate estimates get complicated quickly, as you need to account for the initial distribution of stars in the stellar population(s) involved (the initial mass function: IMF), the age of the populations, dust extinction, etc. etc.
Gas mass is not too bad either. Depending on the phase of the gas - whether it's ionized, molecular or atomic (neutral) hydrogen it may be possible to measure line emission. Neutral hydrogen shows up in the radio at 21cm from the hyperfine transition (spin flip). Most of the gas mass is in neutral hydrogen. Depending on conditions, the Lyman or Balmer series lines may be visible (the first Balmer line is called ${\rm H}\alpha$ in astronomy jargon, it's a common one to observe). Molecular hydrogen - the stuff that stars are made from directly, think Pillars of Creation, is tougher to measure as it has no strong emission lines. What's usually done is to measure emission from other molecular species - ${\rm CO}$ is a common one - and assume something about what fraction of the gas mass that species makes up.
Dark matter mass is inferred from things like galactic rotation curves or gravitational lensing, which both probe the total mass of the system. When we get a total mass from one of these tracers, we always seem to come up about an order of magnitude short (I'm using "always" very loosely here). This, coupled with cosmological observations that seem to imply there is a lot of matter ("dust" in cosmology jargon) that is not "baryonic", but is rather something else that outguns baryons a little less than 10:1 in mass.
As to the Milky Way, there are a number (about 10 that I know of) of ways you can try to measure the mass. I've co-authored a paper which uses several methods. One fairly well known measurement of the total (not just stellar) mass of the MW and M31 is this one, which is more than a factor of 2 bigger than the one you quote. Other sources are more in line with your number... the uncertainty is still rather large. Here's another paper that does the total mass with a different methodology (and get about $1.26\times10^{12}{\rm M}_\odot$), and also models the stellar mass, finding about $6.43\times10^{10}{\rm M}_\odot$, which is about the same ballpark as most estimates for the Milky Way.
If you're adventurous and want to get your hands dirty, stellar mass estimates for at least several hundred thousand galaxies from the SDSS are readily available. These are based on the luminosity of the galaxies, more or less as I've described above. Total mass estimates also exist, but I can't recall where they're easily obtained right now, and they're more uncertain.
Jerry Schirmer mentioned black holes in the comments, so I may as well add a note. The MW black hole is thought to be about $10^{6}{\rm M}_\odot$, so less than one part in ten thousand of the stellar mass, and perhaps a millionth of the total mass. This is more or less typical, though some particularly large black holes get up to perhaps a hundredth of the mass of their galaxy, at most. SMBH's are not thought to be the dominant mass component in any known galaxy (though of course they do dominate in the very central regions).