The ART of exhaust design is to get this pressure wave to enter the combustion chamber as soon as the exhaust valve opens at peak positive pressure to drive exhaust gases out, then go to peak negative pressure when the intake valve opens. If you time it right you can increase performance by... a LOT.
We know the pressure wave travels at the speed of sound, so we can figure out how long the pipe should be, to maximize the effect at a given RPM.
Through the magic of fluid dynamics, we know that this pressure wave will rebound or reflect when it hits a change in area, like the beginning of the muffler... so then you get TWO rebounds of the pressure wave, one at the muffler, and another at the end of the muffler, so you get the effect at two RPMs. Put a megaphone muffler on it, and the muffler will amplify the wave, put a reverse megaphone muffler on it to amplify AND increase the speed of the wave.
If you have a 180 degree twin you can port this pressure wave from cylinder A into cylinder B, using a cross-over pipe.
If you have a twin, you can use a 2 into 1 pipe, and use the pressure wave off cylinder A into cylinder B... but you also get a rebound when the pressure wave hits the collector, then the muffler, then the end of the muffler, so you get 3 rebounds in each pipe, which results in 6 rebounds per cylinder
Then there's 4 into 2 into 1 pipes, then there's multiple cylinders, like V8s that each cylinder has a 180 degree opposite, that do 4 into 2 into 1 into 1 into 2 mufflers... that melts your brain trying to figure out where the 8 different waves are going.