Here's a video discussion of Lavoisier, Dalton and Avogadro (11min): CrashCourse Chemistry: The Fundamental Law, on YouTube
Dalton's atomic theory led to a new question: if each element has atoms with a characteristic mass, what are those masses? If water is 88.9% O, 11.1% H, what is the atomic mass of O in terms of H (if you assume H is 1.00)? To answer, you need the formula: H2O (2 H atoms for 1 O atom) 11.1/2 = 5.55 88.9/5.55 = 16.0 (this is the atomic weight of O, assuming H is ~1)
But early chemists didn't know the formulas, because they didn't know the atomic weights! Dalton assumed that the simplest formula (example: HO) was right, but this was usually wrong! How could they figure out the formulas?
In 1808, Gay-Lussac published results that showed what volumes of gases combined with each other in chemical reactions. For instance (O is oxygen, H is hydrogen, N is nitrogen, L is liters):
Gay-Lussac's Law: volume ratios in gas reactions are whole numbers
Based on Gay-Lussac's Law, we can guess the following: equal volumes of gas at the same temperature (T) and pressure (P) have the same number of "particles".
How was this received? Dalton didn't believe Gay-Lussac's law, because the densities of the gases seem wrong. Oxygen gas is denser than steam (water gas), even though water is oxygen plus hydrogen. Why? Also Gay-Lussac didn't push the conclusions of his law as far as he could have because Berthollet (who believed that combining ratios of elements could vary) was his mentor.
1811: Avogadro explained the problems with Gay-Lussac's law by saying that equal volumes of gases (at the same T and P) have the same number of molecules. The elemental gases were present not as single atoms but as diatomic molecules (such as H2, O2, N2). Now the equations from Gay-Lussac's law are:
What is a molecule? It is a strongly-bonded collection of atoms. Molecules usually remain intact when vaporized into the gas phase. Molecular compounds (compounds containing molecules, as compared to ionic compounds discussed later) are usually made of non-metal elements such as C, O, S, P, H, Cl, etc.
Avogadro's hypothesis could have cleared up all the confusion about formulas, and allowed good atomic weight calculations. But people either ignored him or said it was impossible. The next section explains why.