To be honest I didn’t really know the answer to this, the only thing I knew was it was to do with the combustion of gases which thrusts the rockets (the fire is just a bi-product of the explosion). So I looked it up and this is what I got:
Its to do with Newton’s Third Law based on an action and reaction. The force (action) is generated by hot gases firing backwards from the rockets engines which pushes the rocket forward through space (reaction).
They use liquid-fuel engines. Liquid hydrogen and liquid oxygen, originally stored at very low temperatures (to keep them a liquid rather than gas) go into a combustion chamber at very high temperatures, the hot exhausts escape through a jet nozzle which produces thrust.
So although you can only see the flames coming out of the rocket there is also a lot of gases which is what pushes the rocket.
Glad you asked that question I’ve learnt something new.