# Why is the "instanton map" surjective and do we compactify the space or not?

I discuss a very similar confusion in this answer of mine.

Both approaches are trying to look for the same thing, inequivalent principal $G$-bundles on the compactified spacetime. Because it does not use the language of principal bundles, the physical literature is often very confused about what is actually going on mathematically. In the linked answer I explain why we need to look at compactified spacetime and are actually looking for inequivalent principal $G$-bundles over compactified spacetime. The first and the second approach are both attempts to physically motivate the conclusion that we really need to look at classes of maps from $S^3$ to $G$.

In the end, the point is that principal $G$-bundles, whose Chern class is the "instanton number", can be constructed on $S^4$ (compactified spacetime) by specifying the transition function on the overlap of two contractible patches covering $S^4$, and that overlap is homotopically equivalent to $S^3$, so you end up with homotopy classes $S^3 \to G$ classifying principal bundles (I explain this clutching construction a bit more in this answer of mine). This overlap is what traditional physics texts mean by the "sphere at infinity" or "border of spacetime". Whether you motivate it by looking at the "boundary" of spacetime $\mathbb{R}^4$ or by compactifying space $\mathbb{R}^3$ doesn't really matter.

I don't know what you're talking about in the part where you talk about maps $S^n\to S^m$, but it is a fact that $\pi_3(G)$ is $\mathbb{Z}$ for simple Lie groups and $\mathbb{Z}^n$ for more complicated Lie groups. $\pi_3(S^n)$, i.e. homotopy classes of maps $S^3 \mapsto S^n$, is either $0$ or $\mathbb{Z}$ depending on $n$, so this isn't a worrisome discrepancy - talking about the spheres adds nothing over looking just at $\pi_3(G)$.