Group structure on pointed homotopy classes [X,S^1]
Solution 1:
In general, $[X, K(G, n)]$ is a group whenever $G$ is abelian. This comes from the homotopy commutative, homotopy associative $H$-space structure on $K(G, n)$ which has inverses modulo homotopy.
This structure can be easily seen to come from the map $$K(G \times G, n) \simeq K(G, n) \times K(G, n) \to K(G, n)$$ induced from the group addition map $G \times G \to G$. This is homotopy associative and homotopy commutative since the group addition on $G$ is associative and commutative. The inverse map is the $K(-, n)$-level map induced from the map $G\to G$ defined by $x \mapsto x^{-1}$.
The group addition on $[X, K(G, n)]$ is defined by taking representatives $f, g : X \to K(G, n)$ of two chosen homotopy class $[f], [g]$, and defining the multiplication map $$f * g : X \to K(G, n) \times K(G, n) \to K(G, n)$$ where the first factor $X \to K(G, n) \times K(G, n)$ in the composition is defined by $x \mapsto (f(x), g(x))$. The addition is then $[X, K(G, n)] \times [X, K(G, n)] \to [X, K(G, n)]$ given by $([f], [g]) \mapsto [f*g]$. You can easily verify that this in fact satisfies the axioms of group addition.
In particular, restricting to the case $G = \Bbb Z$ and $n = 1$, you have a group structure on $[X, S^1]$.
(As a side-note, $[X, K(G, n)]$ is also in bijective correspondence with $H^n(X;G)$, and in fact you get an isomorphism of groups when $[X, K(G, n)]$ is given the structure of a group as defined above. The idea of the proof is to show that $[X, K(G, n)]$ is a reduced cohomology theory satisfying the dimension axiom. Then by classification of reduced cohomology theory, the isomorphism of functors $[-, K(G, n)]\cong H^n(-;G)$ follows)