A molecule can have resonance structures when it has a lone pair or a double bond on the atom next to a double bond.
Whenever you can draw two or more Lewis structures for a molecule differing only in the locations of the electrons the actual structure is none of the structures but is a hybrid of them all.
For example what is the Lewis structure of the nitrite ion NO?
1. Decide which is the central atom in the structure. That will normally be the least electronegative atom (N).
2. Draw a skeleton structure in which the other atoms are single-bonded to the central atom: O-N-O.
3. Draw a trial structure by putting electron pairs around every atom until each gets an octet. In this editor I will have to write it as ::-N(::)-::
4. Count the in your trial structure (20).
5. Now count the you actually have available.
1 N + 2 O + 1 = 17 + 26 +1 = 18.
The trial structure has two more electrons than are available.
6. Draw a new trial structure this time inserting one double bond for each extra pair of electrons: O-N=O and O=N-O (two possibilities) Right here the two possibilities tell us that that we will have two resonance structures.
7. As before add valence electrons to give each atom an octet:
8. Assign formal charges to each atom.
Each atom owns its lone pair electrons and half of the shared pairs.
The right hand O atom has 6 lone pair electrons plus 1 from the single bond. This is one more electron than in an isolated O atom. So the formal charge on O is -1.
The two resonance structures are:
The actual structure is none of these. It is a resonance hybrid of them both.