San Francisco has relatively good public transportation options since it's served by three different agencies: San Francisco Municipal Transportation Agency (SFMTA), Bay Area Rapid Transit (BART), and CalTrain. Nonetheless, thanks to the hilly terrain some neighborhoods are somewhat cut off from public transit, so you'll be better off with your own set of wheels.
San Francisco's transit runs 24 hours a day, though many routes are not. Most start between 5:00-8:00am and stop between 11:00pm-1:00am.
San Francisco has its own app for getting around on trains, buses, and cable cars called MuniMobile.
You can get a full transit map here: https://www.sfmta.com/sites/default/files/maps/2017/SFMTA-WebMap-August2017-j2kl.pdf.
There are 8 BART train stations in San Francisco. Beyond getting you around the east side of the city, BART will also take you into the nearby city of Oakland and its surrounds. MuniMobile won't work on BART but the train service does have a mobile-friendly site (http://m.bart.gov) and third party apps available.
The Muni Metro Rail is much more extensive than BART. SF's western neighborhoods are sparsely served by the rail.
Cable Cars / Street Car
There are three historic cable cars around the Financial District and North Beach neighborhoods. There's also a historic streetcar -- the last one operating in SF -- that runs along the bay from North Beach to SoMa. Unless you have the MuniMobile app, you'll need exact change to ride these cars.
Bus service also becomes less helpful the further west you go in the city. Expect a long walk to the bus stop or, better yet, get your own car or bike.
TRANSIT AND WALKABILITY RATINGS
For each San Francisco neighborhood you'll see a Transit rating and a Walkability rating. The Transit rating tells you how good and reliable public transportation options are in that neighborhood. The Walkability rating tells you how many local amenities (shops, restaurants, fitness options, etc.) you can walk to in that neighborhood.