Resonance structures are different Lewis structures of the same molecule, which means they represent the same molecule/ion with different electron distributions.
To keep all the atoms in place but move electrons around, the molecule must have a pi (π) bond. This can be either the π bond alone, if we are talking about a neutral molecule, or a π bond in combination with a lone pair of electrons.

The requirement of having a pi bond is due to the fact that moving or breaking a sigma (σ) bond would result in a new connectivity of atoms, which goes against the definition of a resonance structure. A new connectivity of atoms, in other words, means a new molecule.
For example, to draw a resonance structure for the following molecule, we cannot start the curved arrow from the middle of the C–O bond, because that implies breaking the bond.

Instead, we could use the lone pair on the oxygen to make a pi (π) bond with the carbon by also moving the electrons of the C=C π bond. The second point is important because otherwise, the middle carbon would be surrounded by 10 electrons, thus exceeding the octet.

The restriction of only moving pi (π) bonds and lone pairs, and not sigma (σ) bonds, is one of the rules for drawing resonance structures. The second main rule is that we cannot exceed the octet of carbon and other second‑row elements. This is true whether we are talking about resonance structures or any other concept in chemistry. These elements can have fewer than eight electrons around them, but not more than that. As an example, consider the following resonance transformations illustrating how the octet rule in organic chemistry:

We are keeping this post short to specifically answer the question “What molecules can have resonance structures?” The short answer is that only molecules with pi (π) bonds can have resonance structures, so whenever you are asked to draw a resonance structure, look for ways of breaking or making a pi (π) bond.

For more detailed discussion and examples, refer to the posts “Rules of Drawing Resonance Structures” and “Major and Minor Resonance Contributors.”
Check Also
- Lewis Structures in Organic Chemistry
- Lewis Structures in Organic Chemistry
- Valency and Formal Charges in Organic Chemistry
- How to Determine the Number of Lone Pairs
- sp3, sp2, and sp Hybridization in Organic Chemistry with Practice Problems
- How to Quickly Determine The sp3, sp2, and sp Hybridization
- Bonding Patterns in Organic Chemistry
- Bond-Line or Skeletal Structures
- Functional Groups in Organic Chemistry with Practice Problems
- Bond-line, Lewis, and Condensed Structures with Practice Problems
- Curved Arrows with Practice Problems
- Resonance Structures in Organic Chemistry with Practice Problems
- Rules for Drawing Resonance Structures
- How to Choose the More Stable Resonance Structure
- Drawing Complex Patterns in Resonance Structures
- Localized and Delocalized Lone Pairs with Practice Problems
- Molecular Representations Quiz