Rockets work due to something called Newton's Third Law of Motion. This
is commonly stated as "For every action, there is an equal and opposite
reaction". In layman's terms, if I push something forward, it must exert a
push "back" onto me.
In the case of a rocket, we use a fuel (like liquid oxygen + liquid
hydrogen, for the Shuttle). The fuel is allowed to react chemically,
producing a product (water) and releasing energy. The energy goes into
heating the product to a high temperature. Since temperate corresponds to
average dispersion in kinetic energy, the molecules of the product start to
dash around at a tremendous speed in essentially random directions.
Now, some of these molecules happen to be heading toward the exhaust
nozzle anyway. They simply escape, and don't concern us. Some others
happen to moving directly away from the nozzle. These molecules smash
into the front wall of the fuel tank and rebound with [in essence] no loss of
energy. But now they're pointing at the nozzle, and they too can escape.
But lo! They've changed direction. The wall must have exerted some force
on them to do this. By Newton's III, that means they in turn pushed on the
wall. Since the wall pushed them rearward (toward the nozzle), they pushed
the wall forward ... and the rocket accelerates in that direction.
What about the molecules who happened to be moving side-to-side (instead
of toward the nozzle or away from it)? Well, they bounce into a wall,
rebounded, bounce into the opposite wall, rebound, etc. But since there
are a lot of these collisions, and since they point every which way, they
tend to cancel out. The rocket doesn't feel any net side-to-side pushes.
(Our earlier molecules had an asymmetry ... they could escape and never
rebound again.)
Of course, since the fuel eventually escapes, you have to keep supplying
more if you want the rocket to accelerate. If you just want it to coast
.... well, that's a story for another time.