Two-stroke exhaust is part science and part art, as far as I can tell. A properly set up system not only scavenges the burnt charge from the combustion chamber, it directs a "reverse" pressure pulse to keep the incoming charge in place.
I have read that a 2cycle has a "secondary" compression ratio, that of the fuel air mixture in the crankcase. When backpressure is too low the mixture can exit the cylinder w/o burning called short circuiting or "4 cycling". An expansion chamber takes advantage of sound waves which travel through the exhaust pipe faster than the spent gases and both pull the gases out and when they return back toward the exhaust port help hold the next fresh charge in the cylinder.