Was drinking one night hanging out with some hippy friends (who I'd met in some computer science courses back at university, doing a software rasterization project). They mentioned a great place with a bunch of different folks, and said I should go. A few nights later I showed up with another friend, and that was that.
It was an amazingly chill party--young folks up through old hippies, people smoking out in the garage at the back of the lot, tech folks chatting about different projects in a kitchen, some other really far out stuff happening elsewhere.
I'd suggest that the big thing to do is to be relaxed, chill, and ask a lot of questions. Don't bore people with your own life if it doesn't enhance what they're talking about or if they don't ask, and keep your mind open to the idea that there is not one fixed path to happiness in life.
Don't brag or be condescending, do be friendly, and be helpful--basically, just be a decent person and doors will open.
EDIT: Addendum. I saw a few things happening that were probably not legal, and I certainly was a bit out of my element. That said, being okay with politely refusing offers that weren't my thing and not making trouble for other folks helped me fit in.
When I lived in Philadelphia I don't think there were regular events of that nature, so I guess it's mostly a Bay Area/SF thing? Manhattan certainly seemed more lively in that regard.
If you're serious, I should tell you that SF is by some estimates the most expensive city in the world:
http://www.huffingtonpost.com/2012/10/22/most-expensive-city...
Also, having lived there myself for years, it's cold most of the year except in August and September, and because of its setting it's difficult to get to or from anywhere else (bridges and crowded freeways). And finally, it's very pretty and it has enormous charm.
Have you seen The Net? http://www.youtube.com/watch?v=doQAwLb-DEE