I am using a Canon 40D with the EF 70-300mm zoom lens. I am finding it difficult to get consistently sharp pictures when cars are moving at speed toward me or away from me. It would appear that the camera is focusing and taking the shot a fraction of a second later. At the speeds of these cars the result is often out of focus. One solution is to manually focus with a prefocus on a particular point and taking the picture when the car enters the frame. But this is not always convenient. I generally use AI focus but I am aware of AI servo which, I believe, continually focuses. I may be better off using this?

I also find that while parts of the car are nicely in focus other parts are not, usually at the rear of the car. Maybe this is a function of the lens?

AI focus is used when you shoot static subjects that can suddenly move. So the camera checks if the subject moves , and if it does , switches to the continuous focusing, that is, servo focus. But it takes time time to decide that and your picture may not be in focus. Also if you use the automatic focusing points option, the camera tracks the subject and choses which focusing point is on the subject that moved, and focuses on that one. This takes time , and it may chose the wrong one too.
So the solution is to use servo focusing and a single focusing sensor (point) , not necessarily the center one, but the one that's best for your composition. Half press the button with the active focusing point on the subject and then the camera starts focusing continuously in that point. Do your best to keep it on the car and shoot. It's not easy, I know, using AF is an aquired skill, (I'm lousy at this one myself), it needs practice. Also, if you pan while continuously shoot, your focusing point may pick something that's between you and the car and focus on that one instead. I'ts good to be aware of that too.
About the fact that a part of the car is out of focus.
You have to look up on the net or a book about the DOF (depth of field)
In short, this is the space in which your image is in focus. It can be very small or very large, depending on the lenns' focal lenght , aperture and distance to the subject.
Long focal length = smaller DOF
Large aperture (smaller F number) = smaller DOF
Closer to the subject = smaller DOF.
So, in your case, the DOF is too small for you to have the whole car in focus. To enlarge it, you have to use a smaller aperture (larger f number ).
How much ?
Because it depends o the distance to the subject AND the focal lenght too, (larger at 70mm and much smaller at 300 mm ) it's good to check an online DOF calculator(google it on the net ) to get a feeling of how it wokrs and what kind of values you have to deal with, and test it on the field with a few shots.
Hope that helps

Thanks very much for the comprehensive reply. With the fast moving cars I was using a fast shutter speed (about 1/400 second). This of course would result in an open aperture setting of about f6.3 or f5.6. With brighter conditions I could of course maintain the higher shutter speed but maybe I should go for an aperture of at least f8 or more to ensure sufficient depth of field. Maybe prefocusing in manual on a point using an aperture of f8 or higher would ensure a sharp picture, as long as the shutter speed was fast enough to avoid motion blurr.

Radu brings some great points. Here's a few more things that I would keep in consideration if I were to go to a race.

Depending how fast the cars were going, maybe 1/400 was not fast enough a shutter speed; next time I would definitely run some tests at 1/1000, 1/2000, and 1/4000 to see how they come out. Not as likely because you say some part of the cars are in focus, but physics is a strange thing at times, and even if the entire car is going 300 km/h, when you talk about relative speed to you, if the car is going through a curve, some parts of it might actually be going faster, or slower, you just never know.

Reversely, I would play with the aperture also, try at f/5.6, f/8.0, f/16.0 and see what part comes out in focus. You can practice on the track when there's no interesting subjects around, and get a good feel of what settings you like better.

I believe it was in an interview with Vincent Laforet that I saw this, but racing car photographers usually go a few days in advance to the track with light meters to scout out the different lighting conditions at different times of the day, so the day of the event, they already know where to position their cameras at each hour and how to set them. Then sun and clouds and rain and sleet and snow mess with their calculations, which is why on the day of the event they can't just hand off the camera to a monkey with a list of settings

The regular people (us) don't have access to that, but on the day of an event we can still do some test shots when there's not much going on, so that when something actually does happen, we're more ready for it.

Keeping the AF in servo focus would also help as Radu said, or I heard of some photographers who line up their shot with manual focus and just wait for a car to pass through their pre-selected DoF. If you read the manual of your camera, it probably says something that AI focus is made for "ordinary" conditions, so it's not perfect for something that has 0 movement (such as a building), or something that has tremendous movement (such as a race car).

Panning is also supposed to help, but I haven't had much experience with this yet.

The problem with test shots is that the screen on the back of the camera is not large enough and with insufficient resolution to see the lack of sharpness or slight lack of focus that only becomes apparent after you get home and view the pictures on a large monitor screen.

The answer I am looking for would involve the use of the camera on site, at the time.

Panning is a matter of practise. Using a shutter speed of 1/1000 or 1/2000 would require the aperture to be wide open, with the resulting lack of depth of field. It would require very bright conditions with a 300mm lens.

The professional photographers have the advantage of being able to get down with the marshalls close to the track and without awkward safety fences in their way. The rest of us have to select a spot where we can see over the safety fence and good enough for good photos.

Yeah, it's definitely not as good as having a laptop with you, but I find on my T2i I can zoom in the image while in image preview, and that usually gives me a decent idea how the picture came out. It's not perfect, but I can spot many bad photos that way.

In regards to this question: I also find that while parts of the car are nicely in focus other parts are not, usually at the rear of the car. Maybe this is a function of the lens?

This can be controlled by tracking a specific part of the car with your camera.

The Following are two consecutive shots:

As you can see in the first shot I was tracking the front fender of the motor cycle and in the second shot I was tracking the rear fender. I did this unintentionally but I think its a great example for the question you are asking. (both of these photo's were mess ups, I didn't mean to cut the riders head off.)

This image above is controlled best as I tracked the riders gas tank. I'm not sure what this effect is called but I'm sure there is some scientific term for this. I hope this is what you were asking. (I know the last image was edited terribly, I didn't know what I was doing when i edited this shot.)

Yes that is my problem. Radu suggested using a single point of focus and tracking that point on your subject. However that would still mean the only part in full focus would be that part tracked as the single focus point. To get it all in focus would, I suppose, require a higher aperture f number, that is a narrower aperture.

I realise now how good are the shots taken by professionals where the car (or bike) is coming toward the camera at high speed. Even in those shots I now see that it is mainly the very front of the car that is sharply in focus. The slightly out of focusness of the rest of the car cunningly giving the impression of speed.

Oh, I think another problem that might come into play is the DoF extends more behind the subject than it does in front. Ideally, you should be focusing about 1/3rd of the way through, which would fall somewhere around the gas tank on a motorcycle, as Tomis observed. Sports cars vary greatly depending what type of race it is, but I would think somewhere around where the side mirrors are on a regular car would be about the 1/3rd mark.

Think of the ideal DoF as being about 0.000001 mm thick, that's the exact focus point. Anything that is that exact distance from your camera will be focused perfectly. Anything that's slightly further or closer than that will be more or less focused depending on aperture, distance, etc etc etc. But the degradation happens more quickly in front of the main focus point than behind it.

If you wanted to shoot a 1 meter ruler lying flat on the ground, you could aim at the 33cm mark and get the whole ruler focused, the 33cm closer to you and the 67 cm further from you.

Maybe that's what's happening, if you focus near the front of the car, your DoF will extend a bit in front of the car, and a bit behind.

Don't forget too - that when shooting racing cars or other fast-moving subjects like that, a faster shutter isn't always the most desirable thing. It seems counter-intuitive...if the subject is moving very fast, you must need a faster shutter...but the act of panning with the subject, if done properly, can keep the subject in pretty good focus...the upshot to using a slower shutter speed is that you get excellent background motion blur, that transmits the feeling of speed. Many race photographers will shoot as slow as 1/30 second shutters, once they've really learned the panning and tracking techniques. The fact that you don't need as much shutter speed means you can stop down the lens a bit to widen the depth of field. If you need to, I'd even raise the ISO a stop or two, so you can give back a few stops of aperture.

For panning...try to find one exact point on the car to follow, and using one focus point right on that spot, don't leave it no matter what. A particular decal, the front wheel, mirror, etc...all can be used to help pace your panning motion.

I hope these charts make sense. Let me know if I need to help explain them. I just recently wrapped my head around this concept myself.

...back to the topic at hand. It is physically impossible to get entire car tack sharp using the panning technique. That is only achived if you are moving at the same speed (and direction, obviously) as your subject. This technique is known as a rig shot.

if you wanted to get as much in focus as you possibly could using the panning technique you would need to have the lens perpendicular to your subject. You may get the entire car to appear sharp however it would be slightly off either the front or back depending on what part of the car you track.

I know this from experience. I was once assigned to shoot bicycle races for 16 hours (two seperate 8 hour shifts) and the location had a really distracting/ugly background that was close to the riders so the only way to hide it was panning shots. it was during those two days of shooting that I began to understand the panning technique.

I've got a friend who's an Astro Physics major and I asked him about panning and how that could affect the sharpness of the image. He says its called the Doppler effect for those of you who want to better understand it.