How does my iPhone (iOS 9) know that I'm about to drive home?
Does it recognize that it has connected to my car's phone system via bluetooth?


This. Precisely this.

It also works if you connect the device to your car system over USB (not just charging, but actually connected to receive phone calls), or start CarPlay if supported by your car.