The resonator is basically a
"big change"
that the sound wave encounters on its journey down the exhaust.

When the sound wave comes down the small exhaust pipe and enters the larger pipe diameter of the resonator,
the abrupt change in area causes a reflected wave backwards towards the engine.

If you need to have a picture of this in your
'Mind's Eye',
this is like the waves in rapids of a river suddenly entering a large lake.
It is the opposite situation to an ocean wave hitting the small entrance to a bay.
In both situations waves are reflected.

In a practical sense, a resonator in effect breaks up the length of the small exhaust pipe into smaller lengths.

If you have length of exhaust pipe between 55 and 75 inches, you would do well to put a resonator in the middle.

Exhaust pipes 'resonate' at different musical notes, just like the long flutes with holes to vary the length,
and the big Pipe Organs in old churches.

The same thing happens if you blow cross ways on the opening of a beer bottle.

If you have an annoying 'drone' noise at some RPM and throttle opening,
you can get rid of it by putting a resonator somewhere in the middle of the length of exhaust pipe, which will turn the 'bad' low frequency drone into two high frequency noises that are not as annoying.

At certain RPMs and throttle settings,
the reflected pulse of sound from the resonator can actually 'cancel' out another noise.

This is the same 'anti-noise' science that high-$ Bose noise reducing headphones use.

With a simple resonator it only works in a narrow sound range though,
although careful design can make the best of it.

The science of this is covered with fancy math at this
General Motors Kettering Institute for Engineering and Management
self-learning course for automotive engineers:

http://paws.kettering.edu/~drussell/GMI-Acoustics/Filters.html

The science of a
Pipe Organ's music
and the noise from an engine exhaust
are closely linked.

You could actually experiment with stuff like this in your bath tub with boards to make different width channels, and use your hand to make waves in the water.

Don't laugh,
this is very similar to what our class did in the laboratory 'wave table' in the PSSC version of High School Physics in 1973.

Sadly, kids today don't get this kind of 'hands-on' High School Physics training.
PSSC Physics came about after the
"1957 Sputnik Scare"
that the Russians were pulling ahead of the USA in Science,
so an serious attempt was made to really teach Physics well to high school students.

http://www.compadre.org/portal/pssc/docs/Haber-Schaim.pdf