My general rule is that one ALWAYS tries to make the octet rule work EXCEPT in a limited number of cases.
i)uneven number of electrons which certainly precludes the octet rule.
ii)elements such as H that can have only two electrons.
iii) elements such as B and Be (many compounds of B have just six electrons and many compounds of Be have just four electrons.) I will try to find an electron dot structure on the web. I shall post it if I can find one.
The number of valence electrons in the entire molecule is 2x5 for the two nitrogen atoms and 4x6 for the four oxygen atoms.
Total # of valence electrons=2x5+4x6=34 electrons or 17 electron pairs. We link the two N's together by a double bond (two shared electron pairs). Each N is linked to two O's by single bonds. So far each N has four electrons pairs around it. If we place three unshared electron pairs on each O, we have used up 34 electrons and all atoms have an octet.
Why doing all this? Because it works: We have used the correct number of valence electrons in linking the six atoms, and every atom is surrounded by an octet. The primary rules are counting the valence electrons correctly, and placing four electron pairs (shared and unshared) around each atom. Exceptions to the Octet Rule are rare. It would take too long to describe and explain them here.
Can I not count? I count 36 that way.