The solution to pollution is dilution; water changes replace a portion of "dirty" water with an equal portion of clean water, effectively diluting the concentrations of undesirable substances in your tank. In an established tank, nitrate is the primary toxin that builds up. Regular water changes are the cheapest, safest and most effective way of keeping nitrate concentrations at reasonable levels. During the tank cycling phase, however, ammonia or nitrite may be the substances that need to be diluted and removed. Likewise, if medications have been added to your tank, they may need to be removed after they've served their primary purpose.
The effectiveness of water changes is determined by two factors: their frequency and the percentage of water that is replaced. The more often water is replaced, or the greater the quantity of replaced water at a change determines overall effectiveness.
The benefits of water changes must be balanced by the stress caused by a sudden change of your tank's water chemistry. If tank water has similar pH, GH (General Hardness) and KH (Carbonate Hardness) as tap water, changing 50% (or more) of the water at one time will not affect fish. On the other hand, if your tank's pH is (for example) 6.3, while your replacement water has a pH of 7.5, replacing 50% of the water all at once will change the pH of your tank significantly, which will stress your fish, possibly enough to kill them.
Because water changes are the first line of defense in dealing with problems such as disease, you want to be able to do large, frequent partial water changes during emergency periods. Consequently, you want your tank's water chemistry to closely match that of your replacement water. That way, you always have the option of performing large water changes on short notice. It is important to note that this is the way tanks start out. When you initially set up your tank, the water is the same as that from your tap. Over time, however, the tank's water chemistry may "drift" relative to tap water due to acidification from the nitrogen cycle, the addition of chemical additives, the use of non-inert tank gravel (e.g. crushed coral or seashells), etc.
The more frequent the changes, the less water that needs to be replaced. However, the longer between changes, the more stressful each change potentially becomes, because a larger portion of the water gets replaced. Replacing roughly 25% of your tank's water bi-weekly is a good minimal starting point, but may not be enough. The proper frequency really depends on such factors as the fish load in your tank. Nonetheless, you should do water changes often enough so that:
Water changes remove nitrates after they've been produced. Nitrogenous substances in the form of uneaten fish food, detritus, etc. can also be removed before they get broken down into nitrate. This is achieved by cleaning your mechanical and biological filter regularly, and by vacuuming the gravel with a gravel cleaner. This should be done every time you perform a water change, e.g. every two weeks.
Note: If your heater becomes partially exposed to air as the water level drops while doing changes, be sure to unplug your heater while doing your water changes. The heater can crack if the water level drops below the heating coil!
Also, be sure to dechlorinate the replacement water before adding it to your tank!