While Fortnine did a great job of explaining the fundamentals, the specifics and nuances are very complex. Headpipe diameter and length are the primary indicator of RPM range, but inlet and outlet cone length, end diameters, length between- all affect peak power, power spread, whether there's a smooth transition into and out of the powerband or a razor-thin line between 'on the pipe' and 'off'. When I raced flat track, every 2-stroke racer who had the skill to tell the difference and the means to acquire them had 3-4 different pipes to choose from depending on track length and condition.
It's almost like it's rocket science or something.