The automatic focus systems in modern cameras are very good but there are a few situations where manual focus is better. Photographing objects with very little contrast usually results in autofocus failing. Taking photos in low light usually means autofocus has nothing to work with. Photographing through windows often confuses autofocus. Taking a photo of many objects at varying distances makes it hard to know which object autofocus will focus on. Finally, autofocus can take time, so photographing fast moving objects with autofocus will often be difficult.
In these situations I switch to manual focus. You can either focus until the object is sharp in the viewfinder or on the LCD screen of a digital camera (but these aren't normally good enough to be able to accurately judge the sharpness). Alternatively estimate the distance and set the lens or camera to that distance. I you are unsure and want to increase your chances of good focus use a long focal ratio.
For example, in the picture above I focussed the camera to infinity before taking the photo through an aircraft window. When taking photos through windows make sure you put the camera close to the window to avoid reflections, and choose the cleanest and least scratched piece of window available. I held the camera upside down to get the lens closer to the glass, then rotated the photo later.
To photograph fast moving objects (for example, the aircraft in my warbirds section) pre-focus before the object even appears on an object at a similar distance, or just set the lens to infinity if the object is fairly distant. Be careful using high focal ratios because this will mean you will have to use a longer shutter speed which often results in blurring because the camera moved while the shutter was open.