This question is related to this question from Dinakar, which I found interesting but don't yet have the background to understand at that level.

Unless I'm mistaken, the rough statement is that $H^n(X;G)$ (the $n$-dimensional cohomology of $X$ with coefficients in $G$) should somehow correspond to (free?) homotopy classes of maps $X \to K(G,n)$. I want to understand this better, in relatively elementary terms. Here are some questions which (I hope) will point me in the right direction.

- What category are we working in? My guess is that $X$ should just be a topological space, the cohomology is singular cohomology, and our maps $X \to K(G,n)$ just need to be continuous.
- Does this carry over if we give $X$ a smooth structure, take de Rham cohomology, and require our maps $X \to K(G,n)$ to be smooth?
- How does addition in $H^n(X;G)$ carry over?
- How does the ring structure on $H^*(X;G)$ carry over? (This has probably been adequately answered to Dinakar already.)