A Lewis structure is a bookkeeping diagram for valence electrons. Each line between two symbols is one shared pair (2 electrons), and each pair of dots is a lone pair that belongs to one atom. Inner electrons are left out because they do not bond. In water, H–O–H with two dot pairs on oxygen, you can count everything at a glance: 2 bonds and 2 lone pairs make 8 valence electrons, exactly what one oxygen (6) and two hydrogens (1 each) bring.
The method works like a budget. Total the valence electrons, adding one for each negative charge and removing one for each positive charge. Put the least electronegative atom (never hydrogen) in the center and join each outer atom to it with a single bond. Fill the outer atoms' octets with lone pairs, put any leftovers on the central atom, and if the center still has fewer than 8, turn an outer lone pair into a shared pair, making a double or triple bond.
A Lewis structure shows which atoms connect and where the electrons are, not the shape. CO2 drawn O=C=O and water drawn H–O–H both look straight on paper, but water is bent at about 104.5° because its two lone pairs push the bonds together. To get the 3D shape, you take the Lewis structure into VSEPR theory. And when two or more valid structures differ only in where a double bond sits, as in ozone, the real molecule is a blend of them, called resonance.
Think of it like this. Drawing a Lewis structure is like spending a budget exactly: the valence electrons are your money, every bond and every lone pair costs 2, and you are done when everything is spent and every atom except hydrogen has 8. Unlike money, a shared pair counts in two atoms' accounts at once.
Core idea. Every valence electron in a molecule is either in a bond or in a lone pair, and a correct Lewis structure accounts for all of them while giving each atom a full outer shell.