In making a balanced chemical equation, you need to figure out two things:
1) What goes into the reaction
2) What comes out of the reaction
In classical science, you could not create or destroy matter, so the amount of what goes in must be equivalent to the amount that comes out.
For example, I could not put 2 Nitrogens into a reaction and only get 1 Nitrogen out, that would mean I destroyed a nitrogen and mass would not be "conserved." Similarly, I could not get 3 nitrogens out or I would have created a nitrogen out of thin air! If I put 2 Nitrogens into a reaction, I need to get 2 Nitrogens back out on the product side, according to the conservation of mass.
This is the principle behind creating and balancing chemical equations. Suppose we took a simple reaction:
H2 + O2 -> H20
This is the combination of hydrogen and oxygen to produce water. In writing the equation, we didn't balance it, so we violated the conservation of mass! Let's see how:
On the input side, we have 2 Hydrogen atoms and 2 Oxygen atoms.
On the output side, we have 2 Hydrogen atoms but only 1 Oxygen atom.
If we were to leave the chemical equation like this, it would mean every time we created a molecule of water, we would destroy one oxygen atom in the process!
Take my word for it, that doesn't happen. We need to figure out a way to balance the equation to reflect the fact that no atoms of oxygen or hydrogen are destroyed in making water. Here is the balanced form:
2*H2 + O2 -> 2*H2O
Let's check to make sure we're balance:
On the input: 4 Hydrogen atoms, 2 Oxygen atoms
On the output: 4 Hydrogen atoms, 2 Oxygen atoms
There we go, no atoms created out of thin air and no atoms destroyed in the reaction. This chemical equation now shows conservation of mass.
Side note: Actually, mass is not conserved all of the time. This is the principle behind Einstein's equation E=mc^2. He showed that mass and energy are one and the same, and he paved the way for the use of nuclear reactions to produce energy and bombs. In fact, when you create a nuclear reaction, some mass is lost as pure energy!
However, in terms of high school chemistry, you don't need to worry about nuclear physics. For all intensive purposes, the conservation of mass will be true for you! :-)