In reference to a certain isotope of a chemical element, atomic weight (more accurately relative atomic mass though also called simply atomic mass) is the mass of one atom of the isotope expressed in units (atomic mass unit, amu) such that the Carbon-12 isotope receives atomic weight 12. It is a dimensionless number. The atomic weight is the sum of neutrons and protons in the nucleus of the atom.
In reference to a certain chemical element, atomic weight (also called mean relative atomic mass, average atomic weight, atomic mass, or average atomic mass) is the average atomic weight of the chemical element's isotopes. The average is taken according to the relative frequencies of the element's isotopes.
Although the term atomic weight is being phased out slowly and being replaced by relative atomic mass, in much current usage - particularly in the form standard atomic weight (as used by IUPAC at this time) - atomic weight is used to refer to the mean relative atomic mass of an element.
A similar definition applies to molecules; it is then called molecular mass. It turns out that one can compute the molecular mass of a compound by adding the atomic masses of its constituent atoms, counted with the proper multiplicities. This technique misses only the chemical binding energy, which is usually negligible.
Various experiments allow to compare masses of atoms or molecules, and atomic and molecular weights can therefore be determined rather easily.
One mole of a substance always weighs exactly the atomic or molecular weight of that substance, expressed in grams. For example, the atomic weight of iron is 55.847, and therefore one mole of iron atoms weighs 55.847 grams.
Before the 1960s, this was expressed so that the Oxygen-16 isotope received the atomic weight 16, however, the proportions of Oxygen-17 and Oxygen-18 present in natural oxygen, which were also used to calculate atomic mass led to two different tables of atomic mass.
Formerly chemists and physicists used two different atomic weight scales. The chemists used a scale such that the natural mixture of oxygen isotopes had an atomic weight 16, while the physicists assigned the same number 16 to the atomic weight of the most common oxygen isotope (containing eight protons and eight neutrons). The unified scale based on C12 met the physicists' need to base the scale on a pure isotope, while being numerically close to the old chemists' scale.