Vaporization: The substance has to be injected into the ionizing tube, where it is turned into a gas if it is not already one. This is done by heating up the substance so much that it vaporizes, which allows the substance to move along the mass spectrometer.
Ionization: The sample is then hit with electrons by an electron-gun, changing the sample so it only has positively-charged ions. This is so the samples are attracted to the magnetic fields, allowing the mass spectrometer to work.
Acceleration: The positively-charged ions are then accelerated through an electric field of negatively charged plates which the ions are attracted to, to allow them to be tested in the next stages.
Separation: As the ions are moved along a magnetic field, the atoms with a higher mass-to-charge ratio will not be affected as much by the magnetic field, while those with a lower mass-to-charge ratio will be affected more. Most atoms only have a single charge, so with those, the angle of the heavier atoms won't change much, while the angle of the lighter atoms will change a lot. This is because they have more mass compared to their single charge.
Detection: There is a detector at the end of the mass spectrometer. When an ion hits the detector, a single electric current is produced at that location, which is then multiplied many times so a computer can notice it. The current produced is always proportional to the amount of ions of that specific type hitting the location. Molecules and atoms of the same type will always hit a specific location of their own.[2][3]
Using the information which the method can collect, it shows the mass-to-charge ratio of the particles, and the relative abundance (how many atoms of each type were in the sample).