The atomic weight (or, more accurately, the atomic mass) of an isotope of a chemical element is the mass of one atom of that isotope, expressed in units (atomic mass unit, amu) such that the Carbon-12 isotope receives atomic weight 12. The atomic weight of a chemical element is defined as the average atomic weight of its isotopes. The average is taken according to the relative frequencies of the element's isotopes.
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.
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.