How do self driving cars work? I don't understand how they know how to drive.
To answer your question - Poorly.
There is no such thing as a fully self driving car. Tesla claims their autopilot system can do driving for you, but even that it's a software system made by humans and is prone to so many errors. So many situations come up that a software can't handle and it needs human intervention. Exactly what @chucktobias linked above, and more stories of how easily the system can be tricked.
How do self driving cars work?
Same as you.
They look at the road (with cameras), and based on what they see, they decide (computers), whether to turn left/right or accelerate/decelerate (with motors).
And they do a terrible job of it.