|MadSci Network: Astronomy|
The simplest answer is: you don't.
The only way to measure the mass of an astronomical object is to watch the influence of its gravity on something else. This is most easily done if it has a natural satellite, since the planet's gravity is what is holding that satellite in orbit.
Other ways include tracking an artificial satellite (that is, a spacecraft) moving past that planet and measuring the influence of the planet's gravity on the trajectory of the spacecraft, or carefully observing other planets in the same system and observing perturbations -- small deviations -- in their orbits that result from the first planet's gravity. It was through that latter procedure that Neptune was discovered: Uranus's orbital motion, as observed after its discovery, was not quite right, and the deviations from a normal elliptical orbit made sense in terms of a large external perturber. It takes a lot of high-quality observations to be able to estimate a mass in this way, however.
Try the links in the MadSci Library for more information on Astronomy.