Understanding how electrons are counted for lone pairs vs. bonds especially when understanding resonance? This is taken from the book Organic Chemistry as a Second Language from page 35.
In the following image:

It is seen that when the electrons from the double bond are pushed into the lone pair electrons, we get 2 electrons as a lone pair.  And when a lone pair electrons are pushed to from a double bond we remove 2 electrons from the oxygen.
The part that confuses me is how the electrons are being counted (especially for octet rule). Let's take the example of oxygen that starts out double bonded (the molecule left of the double headed arrows) and then the double bond electrons get pushed into a lone pair (Oxygen on the right of the double headed arrow with a formal charge of 1).  If I count the first oxygen (double bonded oxygen to the left of the double headed arrow), I get 6 electrons where the double bond counts as 1 electron for each bond, now if I go to the right of the arrow I see that same oxygen I count 7 electrons.  How can a lone pair which is made up of 2 electrons result as being counted as 1 electron when it becomes part of a bond or vice versa?
Count 2 electrons per bond and you'll be fine. The partners of a bond usually share two electrons in their mutual orbitals. While you are correct in thinking 2 divided by 2 is 1, thats not how the octet rule works - count them all.

Left w/ dbl bond: 4 lone pair electrons + 4 bond electrons = 8.

Left w/o dbl bond: 6 lone pairs electrons + 2 bond electrons = 8. 

Octet rule satisfied.