I understand that combustion of gases causes light and heat energy to be emitted. But why do flames have a typical ellipsoidal shape? Can it be due to the variations of air pressure that keep the flammable gases confined in such a typical volume?
Candle flames are ellipsoidal, in the typical conditions of our daily life, because of the flow of the hot gases produced(CO2,...)/heated(surrounding air) during coumbustion. The cylindrical symmetry comes from the shape of the candle (actually the place where combustion occurs). The elongated shape comes from the upward direction (opposite to gravity) of the flow of the gases.
In zero gravity flames tend to spherical shapes. More details about the shape of flames depending on gravity you can find here Flame shape and size(length) depending on gravity .