There are three main types of filtration in order of importance they are:
The least important of the three, Chemical Filtration is not a necessary part of an aquarium filter. Common chemical filtration media's include Activated Carbon and Zeolite. The most common type of filters, Undergravel and Internal filters don't have any real chemical media facilities although recent internals have been made with chambers in them for such a purpose and undergravel uplift tubes have been made with chambers at the top for chemical media their capacity is limited. Chemical media works by absorbing or substituting the chemicals being removed.
The most easily to understand is Mechanical Filtration, which simply put removes particulate material from the water by passing the water though a media that allows water to pass but traps the particles. The most common mechanical filter media is the sponge but others such as filter floss remove smaller particles but need regular replacement.
Now after a brief explanation of the first two we get to Biological Filtration. Biological filtration removes the toxic chemicals that are produced by the fish or any uneaten food. The biological media in your filter that can range from the sponge to sintered glass (Glass beads that have millions of tiny fractures in them) provides home for billions of friendly bacteria that break down the poisonous Ammonia and Nitrite. Without these filter bacteria the toxins the water would quickly raise to armful levels and if not removed will result in the loss of your livestock. Of the many different bacteria that colonize your filter the most important are the Nitrosomonas which break down the deadly Ammonia and produce the less toxic Nitrite and the Nitrobacter and Nitrospira which convert the Nitrite into the low toxic Nitrate. The level of Nitrate in a tank is usually controlled by regular water changes of around 20% to 30% per fortnight.
Filter bacteria are very sensitive to chlorine which is added to water supplies to kill off bacteria so for this reason it is important to never wash media that is being used for biological filtration under the tap. Always wash biological media in water taken from the tank and never too harsh, as this is one part of your tank that works best when it is not totally clean. For undergravel filters there are many gravel cleaning devices available to clean the filter bed.
While you will have to at some time replace your biological media never replace it all at the same time as this would give the same results to your tank as washing your media under tap water know as "New Tank Syndrome" which is when the Ammonia and Nitrite level rise as the filter matures (cycles). When replacing sponges if there is only one piece cut them in half and replace half at a time also squeeze the old half into the new half. On a similar note don't replace all the gravel in your tank if you are using undergravel filtration.
Filters are operated by electricity and have moving parts so it is important to maintain them properly and have some kind of back up plan in case of a power cut such as a supply of an Ammonia removing media such as Zeolite. Most power filters including Power heads pump the water using an impellor; this should be removed and cleaned at regular intervals.
The first of the toxic chemical produced is Ammonia that is excreted by fish though the gills as well as from the break down of solid material and fish waste. When testing for Ammonia it is important to also test the P.H. of the tank and record the temperature as the toxicity of Ammonia varies based on the these two variables. At a higher P.H. and/or water temp Ammonia is very toxic in the extreme of a high temperature and P.H. becoming toxic at less than 0.1mg/l. On the other end of the scale at a low temperate (20oC or less) and an acidic P.H. the toxic level of Ammonia is in excess of 10mg/l.
The product of the break down of Ammonia is Nitrite. The following explains how this happens:
Ammonia + Oxygen is converted to Hydrogen + Oxygen + Nitrite
Nitrites while not as toxic as Ammonia should also be keep at low levels of less than 0.5mg/l but preferably below 0.25mg/l.
Nitrate compared to the previous chemicals as a very low level of toxicity and levels of up to 75mg/l are generally accepted as being safe for most fish but some fish such as Discus and lake Cichlids and also Marines are sensitive to Nitrate and levels should be keep as low as possible in such tanks.
The maturation (cycling) of a biological filter can take from 3 weeks to 3 months depending on the conditions of the tank and if the filter media as been seeded with bacteria from another filter or the adding of water from a mature tank. There are many on the shelf products also for this but I prefer to use the proven and free methods. The development of your filter is shown as:
Ammonia + Oxygen + bicarbonate = New Cell Growth + Nitrate + Water + Carbonic Acid
The above also shows why a biological filter can reduce the P.H. of the tank water by the production of Carbonic Acid.
The performance of bacteria is affected by the P.H, temperature of the tank and oxygen concentration. With a low temperature of less than 10oC or P.H. of less than 6.5 the filter bacteria are much less effective also every effort should be made to ensure that bacteria receive adequately aerated water. Household chemicals and fish medications can also destroy filter bacteria so it is important to ensure that your tank does not take in any of the sprays you are using in the room (Especially insecticides) and that fish medications are checked before use to ensure they don't affect the performance or destroy the biological filter. If a medication does affect the biological filter it is best to treat in a separate hospital tank.