What is the primary mechanism behind nationalism, sports-team-ism, product-ism etc.?
The terms you are looking for are ingroups and outgroups. From wikipedia:


  In sociology and social psychology, an ingroup, is a social group to
  which a person psychologically identifies as being a member. By
  contrast, an outgroup is a social group to which an individual does
  not identify. For example, people may find it psychologically
  meaningful to view themselves according to their race, culture, gender
  or religion. It has been found that the psychological membership of
  social groups and categories is associated with a wide variety of
  phenomena.


Googling got me to this book chapter on the topic, but there's plenty more information out there.