What you need are waypoints.
If you imagine your racetrack has targets along the road, each numbered incrementally as your heading down the road. Each loop, you have to check the distance between the car, and the waypoint - then there's a couple of rules to impliment.
If the distance to the current waypoint gets below the total track width, then increase the current waypoint number.
If the distance is bigger than the last distance, tell the player there going the wrong way.
If the player dies and you want to restart them on the track - use the previous waypoint.
This system would check for complete laps too, no skipping corners because the waypoint system would know that you missed a waypoint. You could easily check which waypoint each car is heading towards and their respective distances between them, this tells you who is in front.
In terms of implimentation, you need an array of 2D waypoints, going round the track, perhaps you'd only need 6 or 7 over a whole track, but they're best positioned before and after major corners, not too close together though, and not on hairpins because it's easy to cut hairpins. You could make use of shortcuts with sensible waypoint positioning though.
Now for each car, you'd need a waypoint number, and a distance - both stored in an array and updated every loop. Say the whole road is 100 DB units wide, once the distance between the car and the waypoint went below 100, you'd increase the waypoint number, and the next loop the waypoint might be 1000 units away, so each waypoint is linked like a pearl necklace. You could actually lay out waypoints on a much higher resolution and use a very similay system, to make the opponents AI, just have a lot of waypoints with speed settings, then have the AI check the distance and speed of the next waypoint and act accordingly - like how F1 drivers all follow the same route around the track. Actually, you could sorta record the enemy AI on the track, you could race around the track, dropping waypoints along the way, then the AI would try and follow you, you'd save the waypoints after a good lap you were happy with. You could have special waypoints that track positions while the rest look after the AI, all recordable by you playing your game.
Van-B
Next time he runs past, GRAB HIM!