You should view the head in your engine as a busy and complex highway for air and fuel. All the air that enters your engine has to flows through the head, mix with fuel and then it glows into and into the cylinder via the inlet valves. This air is usually moving into an at high speed and it can be dramatically hampered if it encounters turbulence or obstructions.
If you have ever dived into a pool of water and hit the surface flat on you suddenly discover that the lovely flowing water is actually a hard barrier. Speed is the critical factor and it equally applies to air as well as water so that air travelling at speed can be viewed as viscous or if you prefer more 'solid'.
We are not hear to discuss the complexities of air flow and dynamics here but we are interested in maximising the performance of our cars head.
Any small ridge, bumpy surface or dimples that the air flows over creates a turbulent stream and effectively restricts the flow of air. This can actually help with fuel vaporisation but in the main turbulence is a bad thing on a performance engine. The aim with gas flowing is to get the air moving as freely through the head as possible and in a controlled way.
The angles of the arterial routes in the head need to be smoothed out and reduced. Where possible the physical area inside the head is increased to allow for greater flow of air and swirls that enhance performance can be included. The spiral flow is a modern application of the science and improves fuel atomisation and air flow. Fitting bigger valves will also enable the air to flow into the engine more freely. The step just after the valves can be smoothed out to allow the air to enter the cylinder more efficiently . The larger the engine capacity the bigger the benefit of gas flowing the head as more air is moving around and this also applies to turbocharged and supercharged engines where there is a much greater flow.
The gas flow is initially measured on a flow bench and as the head is worked it is remeasured. A professional will get a feel for the type of channels that need to be made inside the head and much of this is controlled by a computer to cut the ideal angles and channels out to achieve the desired air flow.
Particular attention should be paid to the ports in a process known as port matching. The ports are the holes into which the induction headers connect to the engine and the exhaust headers connect to holes on the other side of the head.
The aim here is to get these holes matched up on both sides avoiding steps or ridges for smooth inlet and exhaust from the engine. A ridge in either direction can cause turbulence and hamper the air flow. The porting can be done on a DIY basis if you want with a drill with a grinding wheel. it should be done with long sweeping strokes to avoid cutting new grooves and steps into the ports, but a DIY job will not even begin to approach what is possible with the right machining tools. The valves should always be properly seated and a grinding paste can help improve the closure of the valve to the head.
Gas flowing should never be done on a high performance head without the proper tools and measurement devices. Some heads such at that fitted in the S2000 and Type R engines are pretty hard to improve upon (but not impossible.)
The flow should also match the cam duration otherwise you will experience flat spots and an erratic power delivery.