Some San Franciscans hate the cable cars but I for one, love them. I ride the California Street line to work much of the time when we have good weather. What better way to get up steep California street from the Embarcadero? The cable cars are one of those things I recommend you ride at least once. It is an experience like none other. There is the California Street line which is typically used more by locals as it runs from the Embarcadero to Van Ness straight up California Street, through the Financial Dist, Nob Hill and to a residential area.
There is another line more popular with tourists that will take you from the cable car turn around on Powell Street @ Market (4 blocks from Union Square) to Fisherman's Wharf. You can take the Powell/Mason Line which will let you off closer to Pier 39 or you can take the Powell/Hyde street line which will end 2 blocks from Ghirardelli Square. My advice if you're just riding to check it out: Take the Hyde line as it is more scenic and longer.
The cable car charge is $5/per person, one way. Each time you board, you have to pay another $5/per person. This is overpriced and stupid. They obviously make a lot of money off the tourists. What you can do to cut the cost: buy a muni pass! I can't stress this enough if you're going to be in town and ride the cable car more than once. You have the option of a 1, 3, or 7 day pass. This includes the cable car.
Current prices are as follows:
1 day pass - $11
3 day pass -$18
7 day pass - $24
As you can tell, if you ride the cable car more than once, the cost will quickly add up so this will be worth it. In additon to the cable car, your pass also enables you to ride on any Muni vehicle (buses, historic street cars, etc...)
Cable Car Museum
If you're interested in knowing more about the history of the cable cars and how they work, it may be worth your time to visit the cable car museum which is free to all visitors. http://www.cablecarmuseum.org/
For more Muni info, visit http://www.sfmuni.com/