The exhaust while a simple device, accomplishes a difficult task, and it's one that still isn't fully understood due to the dynamic nature of the internal combustion engine.
What you're doing by adjusting length is changing the timing of a negative pressure wave at the exhaust valve. This pressure wave causes the cylinder pressure to decrease even more than it is already, which draws in more air/fuel. This is partly the reason why you can have volumetric efficiencies higher than 100%.
The more valve overlap you have, the more critical and harder it is to get this right. Bikes with stock cams and little overlap are less sensitive to this. This should be fairly intuitive to understand.
While diameter has some effect on the tune length, it's more a velocity issue. The exhaust pipe is an extension of the exhaust port.To paraphrase a NASCAR and NHRA header designer/builder, "isn't it convenient that the port wants to step up in diameter where the exhaust port ends, always?"... he was being sarcastic
.
You can think of it in terms of blowdown. In primary exhaust pipe at high rpm, the exhaust gases are in the pipe while the valve is still open. To preserve velocity and get those exhaust gases moving out as fast as they can, it is common for modern header designers to use a first primary diameter the port size or "up to 10% smaller". It is very rare they use a pipe larger than the port diameter.
This is why you often see steps on stepped headers in the 10" range from the port flange (dependent on port length)... this corresponds with where the blowdown length ends within the header.
By preserving this velocity, you're removing most of the exhaust gases before the piston reaches BDC, so during the exhaust stroke, you've reduced pumping losses.
Granted this can work too well and you have what they call over-scavenge. This is where intake air/fuel is sucked out the exhaust valve during overlap. To get around this, top engine builders either use a cam with less exhaust duration, or they shrink the exhaust valve (which in cylinder heads with inline valves, lets them use a larger intake valve).
Steps, best I can find from both academic and the top builders in the field, are more of a velocity thing than having to do with wave refraction. That being said, any quick change in diameter is going to cause a return pressure wave. This can bee seen using exhaust pressure analyzers, which some have been kind enough to share elsewhere on the internet. I have access to modeling software that shows you this as well.
People have to realize that the exhaust design is a compromise, as is intake length. It's only going to be in tune for a certain rpm range. This isn't an issue for race bikes as their range is fixed. On a street engine, going in and out of tune, there are going to be flat spots in the power curve, this is especially noticeable the more aggressive your cam is. Certain designs do a better job of eliminating these flat spots... a 2-1 with the stock crank phasing should see improvements. The Harley guys have made this very clear and there is good demonstrations of this online elsewhere. On a twingle type engine, it's going to have to be a 2-2 as everything would be arriving in the collector at the same time.
If you use PipeMax, or pay Burns to run it through their program, or use a high end modeling program like EngMod4t, you're going to find the first recommended primary diameter for a XS motor is going to be 1.5" od and less. Length will vary, but you're going to be looking for something about 50" in length from the valve seat to atmosphere for a 2-2 set-up on a stock-ish motor.
Depending on how big the exhaust port is, that will dictate what you run. I'd find the pipe that matches your exhaust port, step up about 12" from it, and then carry it out to the above mentioned length.
My friends are car racers and that's the world I grew up in. 1.75"od pipes are WAY too large for any XS motor. Even 450cc single cylinders are using 1.75" pipes as the initial diameter and they're revving over 10,000rpm and making 70hp (per cylinder). NASCAR is using the same primary size as 40 years ago and making double the hp. The trend is smaller primaries and getting everything right. I know of someone who modified a Jemco on a different application and saw good things come from it.
Another to keep in mind, and this is important when using the smaller primaries. The larger the bend radius the less flow loss. Tight bends would require a larger pipe diameter. This is why if you look at a real high end headers on a car, you'll notice they make a lot of effort to use 6" bend radii. Look at the big bends on the Harley XR-750 flat track bikes.
Last important thing. Carry the pipe out the cylinder head at the same angle the port leaves the cylinder head, the centerlines of the port and header should match. This is something the professionals take great care in doing.
This sums up some of which I've read and collected over the years from top level professionals and academic texts.
Hope this helps and excuse any grammatical errors... I quickly typed this up and haven't looked over any of it.
Cheers,
Bob