Earlier quoted context omitted.
1. The AI in games has access to internal representations of game state and does not have to recognize it from pixels on screen. This is a massive difference. 2. The logic is usually a bunch of (human-authored) scripts consisting of if-else spaghetti.
Also, the AI opponents don't have to play by the same rules. They go by fun > fairness to keep things interesting. That's why you normally can't keep a huge lead on AI opponents, because they "rubberband" back up to you faster than they should be able to. Wouldn't surprise me if they don't even 'drive' in any sense while off-screen, just increment some abstract position relative to the track length. But I don't know…
Then again, maybe this is just done by cheating simply with an RNG.