Pipes affect where and how much HP and torque are made.
First horse power is not the only consideration, torque is also and even more important than hp. Hp and torque curves over the usable rpm range of the motor differs with different pipes. I'm sure you have seen graphs for 6 and 8 cylinder car motor power/torque curves. The exhaust/pipe design affects the shape of the curves (how fast the values rise) and when (rpm) the max torque and power are reached, they also affect how fast the curves drop off after max values.
For the most part the pipes we use today are wide band tuned pipes. Narrow band tuned pipes will produce more power and torque but the curves rise and fall more quickly. The diagram and text I referenced shows how tuned pipes work where fuel and air that are drawn into the pipe is pushed back into the motor by the pressure wave. This in affect is increasing the engine size, bigger engines make more power because they have more fuel and air to burn; turbo charging does the same thing. The problem is narrow band pipes are hard to tune and once the motor is out of the ideal rpm range the hp/torque falls off rapidly. Wide band tuned pipes produce less hp/torque but they are much easier to tune and operate over a wider band.
A few years back an rc magazine published an article testing different pipes on the YS91 ST motor. They showed torque and power curves for the motor without an exhaust and with 6 or so narrow and wide band tuned pipes. I still have the article but don't have a scanner. I'll look for an example and post it later. A graph may help in seeing why different pipes change where and how much hp and torque are made.
Please stand by for faster service!