I was reading the classic paper of Atiyah-Bott on Yang-Mills equations on Riemann surfaces. They mention a theorem attributed to Thom saying that if $X$ is a finite CW complex, then \begin{equation} \text{Map} (X, K(G,n)) = \prod_q K(H^q(X, G), n-q) \end{equation} (assuming they mean homotopy equivalent)
Could someone help me find a reference to this theorem, or at least explain how to obtain the right map between these spaces?
I assume $G$ is discrete here. It's easy to at least compute that the RHS has the correct homotopy groups: writing $[X, Y]$ for the space of maps between $X$ and $Y$ and $B^n G$ for $K(G, n)$, observe that
$$\pi_k [X, B^n G] \cong \pi_0 \Omega^k [X, B^n G] \cong \pi_0 [X, \Omega^k B^n G] \cong \pi_0 [X, B^{n-k} G] \cong H^{n-k}(X, G).$$
It's more interesting to explain why $[X, B^n G]$ is the simplest possible space with those homotopy groups. One way to say it is the following:
There is a model of the functor $G \mapsto BG$ sending a topological group to its classifying space such that if $G$ is a topological abelian group, then so is $BG$; by induction, $B^n G$ can always be modeled by a topological abelian group.
If $B^n G$ is a topological abelian group, then so is $[X, B^n G]$.
Any topological abelian group $A$ is homotopy equivalent to a product $\prod B^n \pi_n(A)$ of Eilenberg-MacLane spaces. Equivalently, its Postnikov invariants vanish.
I don't know a reference for this, unfortunately.