The car compares the current data from its sensors with data gathered throughout millions of other miles traveled by itself and other cars.
All of this information has been previously processed with techniques such as machine learning.