Is it because of subtle behavioral clues that make us "click" and consider the other person a part of the group? Or is it because it smells like team spirit?
It very well might be. We (literally) smell love, victory, fear, along with chemicals that motivate us to cooperate. As was recently shown in double-blind placebo-controlled studies that quantitatively measured generosity and cooperation. Androstadienone, a rather unpleasant smelling molecule abundant in male sweat could make us more cooperative and more likely to think of the other person as "one of us". This molecule, created from male sex hormone testosterone possibly with the help of coryneform bacteria living under arms, was previously shown to have an effect on women - depending on social context and the time in their menstrual cycle. Even though androstadienone does not smell particularly plaasant - rather musky, with subtle urine-like and alcohol notes - merely smelling it is sufficient to maintain high levels of energy-boosting hormone cortisol - possibly by inhibiting an enzyme (the 11β-hydroxysteroid dehydrogenase type 1 aka 11β-HSD1) responsible for its reactivation from cortisone.
Androstadienone is related to another steroid estratetraenol found in the urine of pregnant women. Both molecules in large concentrations can affect mood - improving it in females (also increasing their feeling of being focused and sensitivity to pain) while suppressing males. High testosterone males might even get depressed. So it might not be a good idea to sweat too much, but the right amount of sweating is actually helpful. If you are a male. When it comes to men deciding to cooperate with women, chemistry alone is less helpful. As in the old monkey experiment (Michael and Zumpe, 1982) where the best female strategy was to block male's access to other female monkeys. So, don't sweat it ladies. Just be dominant.
Huoviala P, & Rantala MJ (2013). A Putative Human Pheromone, Androstadienone, Increases Cooperation between Men. PloS one, 8 (5) PMID: 23717389
Lundström JN, Hummel T, & Olsson MJ (2003). Individual differences in sensitivity to the odor of 4,16-androstadien-3-one. Chemical senses, 28 (7), 643-50 PMID: 14578126
Michael RP, Zumpe D. (1982) Influence of olfactory signals on the reproductive behaviour of social groups of rhesus monkeys (Macaca mulatta). J Endocrinol. 95(2):189-205. PMID: 7175415