Who Goes First?
Qualifying order used to be set by a random draw.In 2011 and 2012 the qualifying order was set by practice speeds with the slowest drivers first and the fastest drivers going off last. This is still how it works for the Nationwide and Camping World Truck Series.
In 2013 the Sprint Cup series returned to a random draw to determine qualifying order.
Qualifying order can have a huge affect on the outcome of qualifying. As the track cools later in the afternoon often speeds will increase so drawing a high number is often an advantage.
The Qualifying Run
At the scheduled time NASCAR qualifying will begin. Cars take to the track one at a time. Drivers normally start from pit road and have less than one full lap to get up to speed. The drivers get the green flag the first time they cross the start/finish line. Then drivers get two laps to set their best time, taking the fastest of the two as their official NASCAR qualifying time.
There is some strategy in play here. At a restrictor plate race drivers will "throw away" their first lap by running way up by the outside wall. This gives the engine the maximum amount of time to get up to speed and makes the second lap a little bit quicker.
Conversely, at an abrasive track like Darlington a driver might pit after his first green-flag lap and not even take his second qualifying lap because the car is at its fastest right at the beginning. If the driver feels like he hit his marks on the first lap then he's wasting his time and risking damaging the car by taking another lap which will usually be slower.
More common though are the mid-range "regular" tracks where drivers will go all out for two laps in an effort to set a fast time.
Time vs Speed
Officially NASCAR qualifying is set by the amount of time it takes a driver to complete his one fastest lap. NASCAR times the laps electronically down to one-thousandth of a second (.001). If there is a tie, the team that is higher in car-owner points gets the spot.
Notice that we are talking about time during qualifying and not speed. The formula for converting lap times to miles per hour is:
(length of the track in miles)/(laptime in seconds)*60*60
Qualifying is usually reported in the media in miles per hour but officially it is kept in seconds.