Let me start by striking the obvious. In black and white photography all the colors are replaced by shades of greys ranging from black to white. However, black and white films have a tendency to register some colors better than others, so while we might see a blue sky, film is typically over sensitive to blue and ultra violet light, with the output that skies often photographed as white Exposed).
More than that, the additional problem frequently encountered is that some very different colors produce extremely similar shades of gray, and therefore can not be differentiated; For example, deep reds and greens have a similar tone in black and white.
Filters allow some wavelengths of light to pass through them, while blocking others from reaching the film, and so they alter specific gray tone values. As a rule of thumb, a colored filter will allow light of its own color to pass making its gray tone equivalent lighter, while contrasting colors are blocked resulting in their gray tone equivalent becoming darker. To put it another way, filters generally allow the user to make one set of colors darker, while complimentary colors become lighter.
The scene or subject being photographed often determines the choice of color filter used, but yellow and orange are by far the most valuable tools for day-to-day photography.
The single most useful and versatile color filter for black and white film photography is "yellow". Yellow suppresses its opposite color of blue, so will slightly darken skies and bring out the clouds. It also helps penetrate haze and fog. Simultaneously, it slightly lightens related colors (those next to it in the color spectrum): greens, yellows, oranges and lighter reds. This gives improved differentiation between dissimilar colors, resulting in a more natural look to flesh, and improved contrast in foliage (which is usually many shades of green).
The classic use of yellow filters is landscape photography, but its wider application is any shot with sky, vegetation, or people in the frame. This covers many situations and makes the yellow filter almost compulsory for black and white film photography. If you do not have a yellow filter, go any one now!
Perhaps the second most useful filter is orange. If you've been following the explanation so far, you might have guessed that an orange filter does much the same as a yellow filter, but to a greater degree. Blue skies will be recorded in darker tones, with bold contrast between the sky and clouds. An orange filter will also better penetrate haze and fog. In portrait photography, an orange filter gives skin a healthy, smooth look by reducing the appearance of freckles and blemishes. Orange is also good for architecture because it can increase contrast between different materials and strength texture (bricks are orange so they appear lighter).
An orange filter tends to add a little more excitement. It's an excellent choice when a more dramatic effect is required. Buy one.
A red filter, as you've probably guessed, takes things even further, but to something of an extreme: it's not for everyone or every day use. A red filter will turn a blue sky almost black and make clouds really stand out. It's dramatic, and will increase visibility in haze and fog. Beyond that, it's uses are somewhat specialized, in particular, to increase tonal contrast between flowers and foliage in plant photography (although I can not understand why anyone would want to shoot flowers in black and white). Orange has the same additional application, for a less effect.
Green filters are less useful. They give a boost to grass and trees, but also lighten the sky, which can be countered productive. A green filter is mainly used for photographing plants as it helps separate the green foliage from the bright colored flowers.
Blue filters tend to darken most colors (except blue, which it lightens) and so increase the contrast in an image, which can be used to embiseise mist and haze. Personally, I would not bother with green or blue filters, and would probably give a red a miss too.
There is one more incredibly useful filter, which is even more valuable in color photography: a polarizing filter. There are two types, but the one to buy is a circular filter. Without getting into a boring explanation about the different types of polarizing filters, I'll just say circulars can usually be turned while fitted to a lens, so that the effect they have is seen in the viewfinder, and adjustable. The filter is used to manage reflections, or suppress glare. It's possible to make these either appear or disappear; Depending on the effect you want. Because reflections and skylight tend to be made-up of partially polarized light, a polarizing filter can be used to change the balance of the light in the photograph. What's great about it is – what you see is what you get – and what you get depends upon what angle you twiddle it to.
There are other types of filter, mainly concerned with light level reduction, or special effects, but they're not essential for everyday photography. There are also filters that are extremely common, but do not do very much: skylight and UV filters. These tend to be employed as lens protectors, and that's fine, but if you use a good quality lens, then they do not accomplish much, and could even diminish the performance of a great lens. You'd be better off buying a yellow or orange filter.
The final word on filters has to be about exposure compensation, or "filter factors". Filters typically have the overall effect of decreasing the amount of light transmitted. Filters are there previously normally marked with a filter factor (such as 1.5x, 2x, 3x etc.). A factor of 2x, for example, means that the unfiltered exposure value should multiply by a factor of 2. In other words, the lens aperture has to be opened by one stop (twice as much light). A factor of 4x would be two stops extra, and so on. You only need worry about this if taking a light reading with a hand-held meter. A TTL metering camera, or one that has the "electric eye" around the lens (and is covered by the filter), will automatically meter correctly.
In summary, if you plan to shoot black and white film, do yourself a favor and buy a yellow and orange filter, and give them a try. If you want a filter that has the potential to improve every shot, color photography included, get a circular polarizing filter too.