Resonance and formal charge

When one Lewis diagram can't show where the electrons are, the real molecule is an average of several resonance forms, and formal charge picks out the diagram closest to the real structure.

From AP Chemistry.