Examples (and this is why I'm so picky about giving apps Contacts access):
* Friends that I went to graduate school with. Just based on our degrees (MLISes) and career titles, which are pretty public, and the fact that we keep in contact suggests certain types of hobbies we have in common.
* I grew up partially in some pretty rural areas, as did my sister. So which people my sister keeps in contact with from back then and what they're into is a pretty good indication of what she likes. Otherwise, why would they be in her contacts?
Basically, if your contacts have less scrupulous information practices than you regarding hobbies (e.g. your friend tells FB EVERYTHING) and they're in your phone, it's pretty easy with that info to peg you as 'Greg's friend from rock-climbing club who probably goes out with all of them for craft beer afterwards.'
Presumably association including temporal association around events that are described by others. If I text <shadow friend> frequently around the time I post about frisbee games and bluegrass concerts, odds are they are engaged in those types of activities with me.
Just like anything else: contact name "John airsoft team". It is a circumstantial but accurate assumption in most cases. For example I'm currently on the second hand market for a car, scroll through my contacts and you'd easily work out what I'm looking for