How does Resonance stabilize a molecule?
With the concept Resonance you can describe delocalized electrons in some molecules. To go with your example:


(source)

Imagine the ozone molecule to be frozen in one of those two states. Positive and negative charges are localized, which is generally connected to a higher energy, i.e. a more reactive species. This would be an extreme case for ozone - in reality those electrons will be delocalized all over the molecule. So, what is the reason that molecules with localized electrons/charges have a higher total energy and are, hence, less stable?

Maybe you remember the Particle in a box. I wont go into the quantum chemistry here, but one of the take-away-messages is, that the energy for particles in a infinite square well, which is a very rough approximation of the potential in which the outer electrons reside in, does decrease with $ L^{-2} $. $L$ is the size of the box in which the particle can exist. So, the more delocalized the electrons are, the less total energy in a system.

With this, to correct you question a little bit: Resonance is not the reason why molecules are more stable, it is a concept which describes the bonding in a molecule, in which electrons are delocalized, better than a single Lewis Structure.

I would like to have a feedback if this answer is somewhat understandable.