The exhaust, a high-temperature mix of gases, has an effectively random momentum distribution, and if it is allowed to escape in that form, only a small part of the flow will be moving in the correct direction to contribute to forward thrust.
By careful design the engine bell grows wider so that the pressure decreases in such a way that by the time the exhaust flow has reached the exit of the bell, it is traveling almost completely rearward, maximizing thrust.
The problem with the conventional approach is that the outside air pressure also contributes to confining the flow of the exhaust gases.
Thus, as a rocket climbs through the atmosphere its efficiency, and thus thrust, changes fairly dramatically, often as much as 30%.
There are a wide variety of designs that achieve this goal, with the aerospike being perhaps the most studied among them.