The BART is one of the easiest and best ways of getting into SF from the airport and to the surrounding areas.
The BART system runs on a mileage based formula. Your starting and ending points will determine your fair. There are vending machines throughout the stations that take cash, coins and some machines take credit and debit cards. The fare tickets are cards with stored values in them and at the end of your trip, will be deducted upon your exit.
Just be mindful that the BART stops service about 12:00am and doesn't resume until about 6:00 a.m.
For more information, schedules, times and prices, visit their website.