TITLE: When does a continuous map $f:X\rightarrow \mathbb{H}P^n$ lift to $S^{4n+3}$?
QUESTION [10 upvotes]: Consider the Hopf bundles $$S^1\rightarrow S^{2n+1}\rightarrow \mathbb{C}P^n$$ and $$S^3\rightarrow S^{4n+3}\rightarrow \mathbb{H}P^n.$$
In this question (and also here), it is shown that for any continuous map $f:X\rightarrow \mathbb{C}P^n$, there is a lift $\tilde{f}:X\rightarrow S^{2n+1}$ iff $f^\ast:H^2(\mathbb{C}P^2)\rightarrow H^2(X)$ is the $0$ map.
I'd like to know a similar characterization for the quaternionic Hopf bundles.

Suppose $f:X\rightarrow \mathbb{H}P^n$ is any continuous function.  Is there a nice characterization of when there is a lift $\tilde{f}:X\rightarrow S^{4n+3}$?

The proof for $\mathbb{C}P^n$ relies on the fact that $\mathbb{C}P^\infty$ is a $K(\mathbb{Z},2)$, and so a map to $\mathbb{C}P^\infty$ is homotopically trivial iff the induced map on $H^2$ is $0$.  This part of the proof fails for $\mathbb{H}P^n$.
Now, a necessary condition that $f$ have a lift is that $f^\ast$ be the $0$ map on $H^4$.  But this condition is not sufficient, as the following example demonstrates:
By the long exact sequence in homotopy groups for the quaternionic Hopf fibration, we see that $\pi_5(\mathbb{H}P^n)$ surjects onto $\pi_4(S^3)\cong\mathbb{Z}_2$, so long as $n\geq 1$.  In particular, $\pi_5(\mathbb{H}P^n)\neq 0$.
So, let $X= S^5$ and let $f:X\rightarrow \mathbb{H}P^n$ be homotopically nontrivial.  Then $f^\ast$ is the $0$ map on $H^4$ for trivial reasons, but there is no lift $\tilde{f}$ because $f$ can't factor through a $5$-connected space.
This example shows that it is also necessary that $f$ induce the $0$ map on $\pi_5$.  One can similarly argue that $f$ must induce the $0$ map on $\pi_6$.  But this is as far as I can get.
Thank you!

REPLY [3 votes]: Here are some general statements. Suppose $X$ is a space and $\pi : E \to B$ is a map of spaces. Given a map $f : X \to B$, we might want to know when $f$ admits a lift to $E$ up to homotopy (that is, a map $\tilde{f} : X \to E$ together with a homotopy $\pi \circ \tilde{f} \cong f$). The reason this is a more fun question to ask than the question of whether $f$ admits a lift is that it is a homotopically invariant question to ask, and so we can hope to get a homotopically invariant answer. 
The general answer is the following. Assume for simplicity that $B$ is path-connected and pick a basepoint of it. Let $f$ be the homotopy fiber of $\pi$, so that $E$ is (up to homotopy) an $F$-fibration over $B$. Considering the homotopy pullback of the diagram $X \xrightarrow{f} B \xleftarrow{\pi} E$ shows that a lift up to homotopy iff the homotopy pullback $F$-fibration $X \times_B E$ over $X$ has a homotopy section.
Now I believe it is furthermore the case that if we replace $\pi$ with an actual fibration, then above we can replace "homotopy lift" with "lift," "homotopy pullback" with "pullback" and "homotopy section" with "section." But don't quote me on this.
In any case, in general obstructions to the existence of a homotopy section of an $F$-fibration over a space live in the (local) cohomology groups $H^{n+1}(X, \pi_n(F))$, where $\pi_n(F)$ denotes a local system and not just a group (you can ignore this if $X$ is simply connected). If $F$ has infinitely many nonzero homotopy groups then there are infinitely many of these obstructions, although if $X$ has finite cohomological dimension then all but finitely many of them automatically vanish. I may need to assume that the fibration has a Postnikov tower. 
Things get simpler if $\pi$ is itself the homotopy fiber of a further map $\phi : B \to Y$ for some based space $Y$, so that we have a fiber sequence
$$F \cong \Omega Y \to E \xrightarrow{\pi} B \xrightarrow{\phi} Y.$$
In this case $E$ is now a homotopy "principal $\Omega Y$-bundle" over $B$ and the situation simplifies: by the universal property of the homotopy fiber, $f$ admits a homotopy lift iff the composite $\phi \circ f : X \to Y$ is nullhomotopic. In the nicest cases $Y$ is a product of Eilenberg-MacLane spaces so we immediately see that we have a complete set of obstructions given by various cohomology classes, but even if this isn't the case we can still get a complete set of obstructions by looking at a Postnikov tower of $Y$ if one exists; these will now live in $H^n(X, \pi_n(Y))$ (which is the thing one expects if $Y$ is a product of Eilenberg-MacLane spaces). 
In this particular case we can take $Y = BSU(2)$ which has infinitely many nonzero homotopy groups, so there are infinitely many obstructions as already mentioned, although again all but finitely many of them can be ignored depending on the cohomological dimension of $X$.