Stages of operation:
 injection
 vaporisation
 ionisation
 acceleration
 deflection
 detection
injection:  the sample is injected into the vaporisation chamber  
vaporisation  it is vaporised and the gas streams into the ionisation chamber  
ionisation  the electron beam knocks an electron off the vaporised particles makong positive ions  
acceleration  the positive ions are attracted towards the accelerating plates  
deflection  the magnetic field deflects the lighter ions more than the heavy ions  
detection  as the magnetic field is varied by the controller, ions with different masses are detected  these are recorded on the mass spectrum.  
click on the shockwave demonstration to see all these stages in operation 
The angle of deflection of each fragment is proportional to it's mass (actually the mass:charge ratio, but as the charge is always the same and equal to the charge on an electron, but positive, then we can talk about the mass alone), and so it is possible to find the relative atomic mass of each 'spike' the height of the spike represents the frequency, therefore, the abundance can be calculated.
The relative atomic mass is the weighted average of the isotope masses.
Example:
Rubidium has two isotopes Rubidium85 and Rubidium 87 which have relative abundancies of 72% and 28% respectively.
In 100 atoms there are 72 Rb atoms with a mass of 85 and 28 Rb atoms with a mass of 87
Total mass of the rubidium atoms is: (72 x 85) + (28 x 87) =8556
Therefore the average mass = 85,56
Rubidium has a relative atomic mass of 85,56

