Indeed, the statement is that homotopy classes of continuous maps of pointed spaces [X, K(G, n)]
are in 1-1 correspondence with the elements of singular homology H^n(X, G)
for a CW-complex X.
The simplest example would be G = Z
, n = 1
. Then you have K(Z, 1) = S^1
and you can use a first cohomology class c \in H^1(X, Z)
to map the 1-skeleton of X to S^1
(edge e
will make c(e)
loops around S^1
). It's not hard to check that it gives the equivalence.
You also see that the choice of basepoint is irrelevant since you can shift it without affecting homotopy.
The example also helps to see that the additivity doesn't become obvious just from the things you wrote. To add properly, you need some kind of addition map on your target, that is, K(G, n) \times K(G, n) \to K(G, n)
. How you prove this depends on your definition of Eilenberg-MacLain space, e.g. by universality. The ring structure comes from the wedge product (from an answer to this question).
If X is smooth than the de Rham cohomology is the same as singular cohomology, but the space K(G, n)
has so little chance of being smooth (there was a question on MathOverflow explaining this) that the smooth maps are not really relevant, as expected for homotopy theory.