How can I determine if and when a molecule has or needs a resonance structure?

For a compound to show resonating structures, it should

1) have a planar structure
2) follow Huckel’s rule of electron numbers
3) hybridization remains same and fixed.
4) no of lone pairs remain same.

A molecule can have resonance structures when it has a lone pair or a double bond on the atom next to a double bond. For example: nitrite ion, NO₂⁻

• Decide which is the central atom in the structure. That will normally be the least electronegative atom (N).
• Draw a skeleton structure in which the other atoms are single-bonded to the central atom: O-N-O.
• Draw a trial structure by putting electron pairs around every atom until each get an octet.
• Count the valence electrons in your trial structure
• 1 N + 2 O + 1 = 1×7 + 2×6 +1 = 18.
• 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)
• The two possibilities tell us that we will have two resonance structures. As before, add valence electrons to give each atom an octet. Assign formal charges to each atom.