Stars & the Milky Way Galaxy
Binary stars (two stars orbiting their common center of mass) present a way to determine the masses of those stars.
The color of light observed from a luminous object, such as a star, can change due to the motion of the object relative to the observer (towards or away). Thinking of the stream of photons leaving a star as a time series of small signals, ...
Sometimes the stars of binary systems are near enough to each other as to be indistiguishable from great distances by sight with modest telescopes; however, if the stars are of different spectral types, then an apparent "single" star may be determined to actually be two or more stars by observing combinations of spectral lines normally associated with separate spectral types.
As the stars in these systems orbit their common center of mass, one star may be moving away from the observer, while the other is moving towards (depending on the orientation of the plane of the stars' orbit with respect to the observer — anywhere from "overhead" to "edge-on"; a system seen from overhead will not have the stars moving towards or away from the observer, but only side to side). Half of their respective orbits later, the motion towards/away will be reversed, and what was blue-shifted light has become red-shifted and vice versa. More specifically, the positions of absorption line features for each star will move relative to their "rest wavelength" in the direction of the red or blue end of the visible spectrum, and the speed associated with this shift can be determined to help calculate the mass of stars necessary to have that orbital speed.
Where binaries are sufficiently separated spatially as to be observed as two stars, their orbital speeds may be determined thanks to Kepler's Laws. Such binaries need to be observed for long enough that the orbital period of the stars can be determined, which in combination with a calculation of the distance moved in that time (could be from parallax measurements) gives a speed. The bright two stars of the constellation Gemini, Castor and Pollux, make a famous example of a visual binary; these two stars, and their apparent motions over time, have been observed for hundreds of years.
If the orbital plane of a binary system is edge-on to the observer, then the stars will at times eclipse each other (may be total or partial eclipses, depending on the relative sizes of the stars). To a distant observer, these eclipses may only look like temporary reductions in the amount of starlight detected from the binary (as one star is blocking some or all of the light from the other). Measuring the time delay between these eclipse events leads to the orbital period of the system. With the blue- or redshift observed for absorption lines in the stars, the orbital speed can be determined — and in combination with the orbital period, the masses of those stars.