A filter is a camera accessory consisting of an optical filter that can be inserted in the optical path. The filter can be a square optical glass mounted on a holder accessory; or, more commonly, a glass or plastic disk with a metal or plastic ring frame, which can be screwed in front of the lens.
Filters are commonly used in black and white photography to manipulate contrast. For example a yellow filter will enhance the contrast between clouds and sky by darkening the latter. Orange and red filters will have a stronger effect.

Effects of using a polarizer and a red filter in black-and-white photography
Filters are less common in color photography and even less in digital photography. A major use is to compensate the effects of lighting not balanced for the film stock's rated color temperature (usually 3200K for professional tungsten lights and 5500K for daylight): e.g., the 80A blue filter used with daylight film corrects the orange/reddish cast of household tungsten lighting, while the 85 used with tungsten film will correct the bluish cast of daylight. Color correction filters are identified by numbers which sometimes vary from manufacturer to manufacturer.
Although the 80A filter is mainly used to correct for the excessive redness of tungsten lighting, it can also be used to oversaturate scenes that already have blue. The photo on the left was shot with a polarizer, while the one on the right was shot with a polarizer and an 80A filter:
Often in color photography, a polarizing filter will be used to darken overly light skys. The filter also whitens clouds and increases the contrast between the clouds and the sky. Atmospheric haze is also reduced and overall color saturation is increased.
The minuses:
The negative aspects of using filters, though often negligible, include the possibility of loss of image definition if using dirty or scratched filters, and loss of some exposure. The former is best avoided by careful use and maintenance of filters, while the latter usually will not be a problem if planned out properly.
Filters can be used also for special effects. A diffusion filter softens subjects and generates a dreamy haze; it can be improvised by smearing Vaseline on a UV filter.
-----------
An infrared filter is a filter to remove visible light and only pass infrared light in different wavelengths. These are mainly used in infrared photography.
------
A neutral density filter or ND filter is a "grey" filter. An ideal neutral density filter reduces light of all wavelengths or colors equally. The purpose of standard photographic neutral density filters is to allow the photographer greater flexibility to change the aperture or exposure time, allowing for more control, particularly in extreme circumstances.
------
UV filters are used for general photography to reduce haziness or fogginess created by UV light. UV filters are transparent thus one doesn't have to remove it from his/her camera, moreover this is also why people use it as a protector filter for their lens. The UV filter absorbs ultra-violet and blue rays effectively without the increase of exposure.
Source: Wikipedia