I've previously developed a realistic simulation of this very thing. It can either be done simply if you just want an arcade racer, or with some complexity if you want a realistic simulation.
In a nutshell, here's what you do...
Initial Setup and Calculations:
Run Loop Stuff:
Of course there can be more complexity to all of this, and more things to simulate, so hopefully I didn't mangle any formulas too badly in this summary, but you should be able to get the idea.