Air can contain two forms of water that causes problems. Water vapor, and water particles.
Water vapor can only be removed (as far as I know) by a dessicant. Essentially a super dry "stuff" that absorbs the vapor as it passes by. You have to remove it every so often (when it gets full of moisture) and dry it out. Like by spreading it out on a cookie sheet and baking it at a low temp.
Water particles are easily removed by the classic cheap and simple water separator. Basically air turns a corner, and the particles can't, they get trapped.
So... why all the expense? The trick to all of this is knowing the relationship between the two. Air, when hot, can hold a lot of water as vapor. As it cools off, the vapor condenses into particles that accumulate on whatever. The inside of your tank for example.
As air comes into your compressor, it contains some vapor usually. As it gets compressed, it certainly won't give up that vapor. However, as it first enters your tank, if it's been sitting and is ambient temperature, it gets cooled very quickly. Also, it undergoes some form of sudden expansion as well, as the air won't enter the tank unless it's at a higher pressure. Both of these things cause the vapor in the air to condense into particles that wind up in the bottom of your tank. During this time, you get nice dry air at the nozzle.
However, after the compressor has been working a while, the tank heats up. Also, as the tank fills up, the pressure differential is less and less. Therefore, much less cooling or expansion takes place, and much less vapor condenses, so it doesn't get stuck in the tank, but rather goes right along through it to the end of your air hose. As you use the air, it definitely expands and cools and turns into particles that wind up in your paint job. Or inside your air tool.
If you have a rather long expansive black iron pipe system, the air usually gets cooled enough that the moisture gets condensed and left along the way. Simple traps work pretty good here. However, if the water is left in there, as you use your compressor a lot, the hot air traveling along, being hotter than it was when you started (because you compressed it) has an affinity for moisture, and can pick up MORE than you started with. It's just good to know this...
So, knowing all of this, you can make a better decision on how to get dry air.
If you're in a pinch, throw a coil of air tubing in a bucket of ice water and put a cheap particle separator at the end, then go to whatever you're using (a paint sprayer, air tool, sand blaster).
If you have parts and time, reconfigure your air compressor entirely. Take the output of the pump through a big old coil of copper tubing with an air conditioner blowing on it, then through a particle separator, then into the tank. This will keep the moisture out of your tank.
Some particle separators automatically drain themselves. This is essentially what a commercial dryer is. An air conditioner, a coil of tubing, and a auto draining separator.
But usually even they are put after the tank, which is a flawed design.
Sorry so long winded, but hope this takes some of the mystery out of getting water out of your air.
Tools