I don't think you will ever find a definitive answer for this, as it varies so much from venue to venue and series to series, not to mention external factors (weather etc.) play just as big a role. However, qualifying is certainly important, and I will explain why below.
Firstly, let's look at the factors influencing the importance of starting position;
- The race distance - At F1 tracks, the grid positions are separated by 8 metres. Therefore, starting 20th compared with 1st is a distance disadvantage of 152 metres. If the race is just one lap, this disadvantage is of course going to be tougher to overcome than in a 24 hour race - the initial disadvantage will make up a greater percentage of the overall race distance on a shorter race. Of course, the grid separation and start procedure (rolling start vs. standing start) also have an effect on determining the initial distance disadvantage.
- The number of cars - The more cars, the greater the initial distance disadvantage. Likewise, more cars means more cars to overtake, and generally you will lost time battling for positions, so the more cars you have to battle with the greater the disadvantage.
- Ease of overtaking - In F1 at Monaco for example, it is very difficult to overtake, so the advantage of starting on pole is generally far greater than Nascar for example.
- How closely matched the competitors are - If for example you qualify 20th and the lap time difference between 15th and 1st is 1.5 seconds, then you will lose 1.5 seconds for each lap you are stuck trying to get past 15th place. If however, the difference is just 0.05 seconds, then of course the time loss getting through the field is going to be far less.
However, there are also several other external factors that can impact the importance of qualifying positions, and these are far more unpredictable;
- The weather - One critical thing regarding the weather is the wind - both its speed and direction. If for example there is a strong headwind on the main straight, then the effect of the slipstream will be greatly increased, putting the lead driver at a disadvantage and the following drivers at more of an advantage.
- Safety cars - If a safety car is deployed, the field close up. Therefore, a driver may have qualified last and lost 30 seconds to the leader battling through to 2nd. However, if a safety car is deployed near the end of the race, this driver is now merely tenths of a second behind the overall leader. In this scenario, the disadvantages of starting lower down the order no longer have such a significant impact on the race result.
- The rules of the competition - In F1 for example, the rules several years ago were that the cars could not refuel from qualifying to the race. Therefore, a car may qualify on a heavier fuel load, thereby meaning they are slower and qualify lower down the order. However, this may be the optimum race strategy. Therefore, starting a few positions further back will be less important than gaining time later on in the race when the strategy pays off.
Therefore, in answer to your question, there are several factors which play a role in determining how important qualifying is. However, even if all of the factors mentioned above play out to the disadvantage of the leader, the optimum position to be in the race would still probably be no lower than 3rd or 4th, with the perfect time to take the lead being on the last lap (in some cases the final corner).
For the purposes of an example, let's take 3rd place as being the optimum position on the final lap. You then have to consider how the driver can make sure they are in this optimum position at the right time. This is made much easier by qualifying higher up - the leader simply has to slow down and let two drivers by at the right time to get into the optimum position. Whereas a driver qualifying lower down the order has to overtake drivers to get into this optimum position. Of course, you could argue the driver in the best position is the one who qualified 3rd, as they can try to maintain the optimum position for the entire race. However, in most circumstances, it would be extremely difficult to judge their qualifying lap such that they drive fast enough to qualify 3rd, but slow enough not to qualify on pole or 2nd.
Even if you are in the optimum position at the right time, this is still just theoretically the best position and it would be reliant on the driver making the most of this opportunity - if they mess it up, they won't get another chance given it is the last lap and possibly last corner. Therefore, in most circumstances, drivers would probably still prefer to be out in front, unless the advantage of being behind is extremely significant.
Another thing to factor in as well is that qualifying further back puts you at greater risk of being caught up in accidents, particularly first lap incidents.
In conclusion, qualifying is always important in making the race easier. Depending on the circumstances, qualifying may be more or less important, and sometimes being the leader isn't the optimum place to be. However, the optimum place to be is almost always somewhere very near the front of the field, and the simplest way to ensure you are at or near this optimum position is to qualify as far up the order as possible. However, there are an awful lot of factors that are as important, if not more so, than qualifying, and that is what makes motor-sport unpredictable and exciting.