Great question! Dr. Ken Rubin, a Professor in
the Department of Geology at the University of
Hawaii has a very clear explanation that walks
through all of the evidence that allows us to
figure out what is in the earth´s core.
First, we know the overall density and mass of the
Earth based on measurements of how the Earth
perturbs the orbits of other planets and the moon.
Second, we know the overall density of the
various layers of the Earth based upon the way in
which seismic pressure waves (compressional waves
created by earthquakes) move through the earth to
arrive at locations remote from the earthquake
Third, by examining a second type of
seismic wave (a shear wave, that is equivalent in
motion to a back and forth rubbing of one's hands
together) we know that the outer part of the core
is liquid, even though it is at immense pressure
from being underneath so much rock. Shear waves
can't travel through liquids.
Forth, we know the overall composition of the
Earth by examining the bulk chemical composition
of the Sun (by examining its light spectrum) and
by analyzing a class of meteorites known as
Chondrites (which have similar composition to the
Sun and are believed to be similar to the material
from which the Earth accreted).
Fifth, we know the composition of the
Earth's crust and its mantle, by examining samples
of them. For the lower mantle, we use experiments
of the effect of pressure on upper (shallow)
mantle minerals to predict the mineralogy of the
lower reaches of the mantle. We then pass seismic
waves through it in the lab to see if our
experimental rocks match the observations.
Six, now that we know the size, mass and
composition of the whole Earth, its crust, and its
mantle, we can construct a balance sheet of
materials and see which chemical elements aren't
in the crust (including atmosphere and
hydrosphere) or mantle that we know should be on
the Earth. These must be in the core.
Seven, to aid us in our assessment, we
recall that we need metallic elements in high
concentration somewhere in the interior of the
Earth to generate our magnetic field. Also, this
metal must be able to be in the liquid state even
at very high pressures.
Adding all this up, we find the core is
predominantly Iron metal (Fe). We find it has a
significant amount of the element Nickel (Ni,
about 4%) and a light element to make it less
dense (about 10% by mass). This light element is
either mostly oxygen or sulfur, with the arguments
for oxygen (too detailed to go into here) being
more believable in general.
We can look at the composition of iron
meteorites as well, which are remnants of small
planetary bodies from early in our solar-system's
history that segregated small cores. The
composition of these metal alloys match closely
what we predict the composition of our core is
using the evidence discussed above.