Headers are one of the easiest bolt-on accessories you can use to improve an engine's performance. The goal of headers is to make it easier for the engine to push exhaust gases out of the cylinders.
When you look at the four-stroke cycle in How Car Engines Work, you can see that the engine produces all of its power during the power stroke. The gasoline in the cylinder burns and expands during this stroke, generating power. The other three strokes are necessary evils required to make the power stroke possible. If these three strokes consume power, they are a drain on the engine.
During the exhaust stroke, a good way for an engine to lose power is through back pressure. The exhaust valve opens at the beginning of the exhaust stroke, and then the piston pushes the exhaust gases out of the cylinder. If there is any amount of resistance that the piston has to push against to force the exhaust gases out, power is wasted. Using two exhaust valves rather than one improves the flow by making the hole that the exhaust gases travel through larger.
In a normal engine, once the exhaust gases exit the cylinder they end up in the exhaust manifold. In a four-cylinder or eight-cylinder engine, there are four cylinders using the same manifold. From the manifold, the exhaust gases flow into one pipe toward the catalytic converter and the muffler. It turns out that the manifold can be an important source of back pressure because exhaust gases from one cylinder build up pressure in the manifold that affects the next cylinder that uses the manifold.
The idea behind an exhaust header is to eliminate the manifold's back pressure. Instead of a common manifold that all of the cylinders share, each cylinder gets its own exhaust pipe. These pipes come together in a larger pipe called the collector. The individual pipes are cut and bent so that each one is the same length as the others. By making them the same length, it guarantees that each cylinder's exhaust gases arrive in the collector spaced out equally so there is no back pressure generated by the cylinders sharing the collector.
Here are some interesting links: