Two atoms with the same number of protons can have different
numbers of neutrons. As an example, most carbon atoms have
6 neutrons and 6 protons, but carbon-14 has 6 protons and 8 neutrons.
If you look at the number for the atomic masses listed in the periodic
table, you will see that carbon does not have a mass of 12, but a little higher. This is because trace amounts of carbon atoms with more than 12 neutrons increase the average weight of carbon.
I found a nice graphic of a
mass spectrometer, a device that can detect
isotopes, at a University of Florida webpage.