I was wondering, how would you find out about the mass and the density of a planet and what the planet is made of? Finding out about the mass might be possible, because you can observe the movements of a planet around a mass center and I can imagine that there are certain ways to use that to calculate its mass. Maybe I am wrong. But what about the density and its material it is made of? How can you know that it's core is not made of gold or uranium?
Assuming you are talking about exoplanets, I'll offer this.
To obtain a density you need a mass and radius. Masses come via two methods - either measuring the radial velocity variations of the star it orbits (the bigger the RV variations, the bigger the planet mass), or so-called transit timing variations. This latter works in multiple "transiting planet" systems, where the planets influence each others' orbits by an amount that depends on their respective masses.
In fact accurate densities only come from transiting planets. These eclipse their parent stars and this gives an estimate of both their orbital periods and radii. The inclination of the orbit can also be found and this pins down a mass estimated by the RV method. The mass and radius combine to give a density.
From there it is mostly a case of theory. We know a little bit about the outer atmospheric compositions of a few giant exoplanets from various clever investigations - transmission spectroscopy, wavelength dependence of the transit, looking at the eclipse of the planet by the star in the infrared. However the interiors of exoplanets are experimentally intractable. It's usually a case of matching theoretically built models, that make assumptions about the composition, with observations in the mass-radius plane.
The diagram below shows an example from Sohl et al. (2012) comparing theoretical models with the masses and radius of currently known low-mass exoplanets.