TITLE: Classification of bundles, Postnikov towers, obstruction theory, local coefficients
QUESTION [11 upvotes]: RECAP on classification of bundles
We want to classify $G$-principal bundles over $X$ (smooth manifold, G compact Lie). These are in 1-1 correspondence with homotopy classes of maps $[X,BG]$ (where $EG\to BG$ is the universal bundle as usual). 
If $BG \simeq K(\pi,n)$ then it's easy:
$$[X, BG]\leftrightarrow H^n(X,\pi),$$
therefore there is a cohomology class that gives us the classification (e.g. the 1st Chern class for the frame bundles of complex line bundles). 
In general, $BG$ can be more complicated, in any case $BG$ has a Postnikov tower which induces a factorization of the classifying map $f\in [X, BG]$ in $(f_i)_i$
$\require{AMScd}$
\begin{CD}
    \vdots@. \vdots\\
    @| @VVV \\
    X@>>f_2> P_2(BG)\\
    @| @VVp_2V \\
    X @>>f_1> P_1(BG)@.\simeq K(\pi_1(BG),1)
\end{CD}
The homotopy type of $f$ is given by the homotopy type of the $f_i$s. Since $P_1(BG)\simeq K(\pi_1(BG),1)$ $f_1$ is given by a cohomology class in $H^1(X, \pi_1(BG))$. However, not any choice of $f_2$ works, because it must lift $f_1$. 
From this answer* I learned that there is a Cartesian diagram
$\require{AMScd}$
\begin{CD}
    X@>>f_2>  P_{2}(BG) @>>> K(\pi_0G,1)\\
    @|  @VVp_2V        @VVV\\
    X @>>f_1> P_1(BG) @>>> K(\pi_2 G,3)_{h\pi_0G}
\end{CD}

1)Explanation/references for this? I was expecting the second column to be something like  $K(\pi_2(BG),2)\to K(\pi_1(BG),1)$, it reminds me of principal fibrations.
2)How to see that these lifts are parametrized by $H^{2}(X,\pi_{2}(BG))$ cohomology with local coefficients twisted by $f_1\in H^1(X,\pi_1(BG))$? Obstruction theory tells the necessary conditions to lift $f_1$ but not how many lifts there are.

In the end we get that the principal bundle is classified by 
$f_1\sim \alpha_1 \in H^1(X,\pi_1(BG))$ and a sequence of cohomology classes $\alpha_k \in H^{k}(X, \pi_k(BG)) $ in the cohomology with local coefficients twisted by $\alpha_1$.

3) How to compute them? Is there any example for say $G=O(2)$? Any link with invariant polynomials in $\mathfrak{g}$ or the Weyl algebra of $\mathfrak{g}$?

This is essentially Denis Nardin's answer.
In his comment Nardin, says another interesting thing if $G=O(n)$, then $\alpha_1 = 0 $ iff the bundle is orientable, $\alpha_1, \alpha_2 = 0$ iff the bundle is spin and so on climbing the Whitehead tower of $O(n)$
$$O(n)\leftarrow SO(n)\leftarrow Spin(n)\leftarrow String(n)\leftarrow ...$$

4)Is this true for any Whitehead tower of groups? Does this implicitly say that the Postnikov tower of $SO(n)$ $(Spin(n))$ is the one of $O(n)$ without the first (second) term?

BG as a twisted product
If $\pi_1(BG)$acts on $\pi_{n+1}(BG)$ trivially then 

the Postnikov tower gives us an expression for $BG$ in terms of a twisted product of Eilenberg-MacLane spaces $BG \simeq K(\pi_1(BG),1)\times_{k_1} K(\pi_2(BG),2)\times_{k_2} \dots$
There is no need of local coefficients for the $\alpha_k$ above.

In the same answer*, Mark Grant says that in the case of $G=O(2)$:


there is a fibration
    $$
K(\mathbb{Z},2)\to E\mathbb{Z}/2\times_{\mathbb{Z}/2} K(\mathbb{Z},2)\to B\mathbb{Z}/2
$$
    given by the twisting of $w_1$ on the universal $SO(2)$ bundle, and this fibration agrees up to homotopy with the fibration 
    $$BSO(2)\to BO(2)\to BO(1).$$ 


Question:

5) Can you explain this in the more general setting of a fibration $F\to E\to B$? Also I do not understand $E\mathbb{Z}/2\times_{\mathbb{Z}/2} K(\mathbb{Z},2)$, what is the $\mathbb{Z}/2$ action on $K(\mathbb{Z},2)$? Grant says $w_1$ is involved but I cannot imagine how. (I know that in general $w_1 \in H^1(X, \pi_1(BO(2))$ gives me an action of $\pi_1(X)$ on $\pi_n(BO(2))$).
  How does this relate to the Whitehead tower above?

*Classification of $O(2)$-bundles in terms of characteristic classes

REPLY [10 votes]: I'll try to answer question 1.  Unfortunately, I know of no especially convenient reference for the case of understanding general Postnikov towers; however, everything I say below is "well known". 
In a Postikov tower for $X$, the map $p=p_n\colon P_n\to P_{n-1}$ is, by definition, a fibration with fiber equivalent to $K(A,n)$, where $A=\pi_n X$.  The idea is that there exists an (essentially unique)  homotopy pullback square 
$\require{AMScd}$
\begin{CD}
     P_{n} @>>> E_F\\
     @VpVV        @VVqV\\
     P_{n-1} @>>> B_F
\end{CD}
where $q$ is the universal example of a fibration with fiber equivalent to $F:=K(A,n)$.  This universal fibration is rarely ever a principal bundle.
Here is the formula for $q$: Let $\def\Aut{\mathrm{Aut}}\def\Map{\mathrm{Map}}$ $\Aut(F)\subseteq \Map(F,F)$ be the union of all components of the mapping space which contain homotopy equivalences.  Then $\Aut(F)$ is a topological monoid which is "grouplike" (i.e., $\pi_0\Aut(F)$ is a group), and which acts on $F$.  Then the map
$$ F_{h\Aut(F)} \to (*)_{h\Aut(F)}=B\Aut(F)$$
is the universal $F$-fibration.
For $F=K(A,n)$, it turns out you can identify $\Aut(F)$ very explicitly.  (I'm going to assume $n\geq 2$ here.)  The construction of Eilenberg-MacLane $A\mapsto K(A,n)$ spaces lifts to a functor 
$$(\text{abelian groups})\to  (\text{topological abelian groups}).$$
Therefore we get a topological group $K(A,n)\rtimes \Aut(A)$ acting on $K(A,n)$ (the $K(A,n)$ acts on itself by left-translation, and $\Aut(A)$ is the discrete automorphism group of $A$.)  It turns out (by a computation) that this group is equivalent (up to homotopy) to the topological monoid $\Aut(K(A,n))$, so
$$B_{K(A,n)} \approx B\Aut(K(A,n)) \approx B\bigl( K(A,n)\rtimes \Aut(A)\bigr) \approx BK(A,n)_{h\Aut(A)}\approx K(A,n+1)_{h\Aut(A)},$$
and
$$E_{K(A,n)} \approx K(A,n)_{h\bigl(K(A,n)\rtimes\Aut(A)\bigr)} \approx (*)_{h\Aut(A)} \approx  B\Aut(A).$$
So the desired pullback square has the form
\begin{CD}
     P_{n} @>>> B\Aut(A)\\
     @VpVV        @VVqV\\
     P_{n-1} @>>> K(A,n+1)_{h\Aut(A)}
\end{CD}
In practice, when you have a Postnikov tower of a space like $BG$, the action of the  fundamental group $\pi_1 BG=\pi_0G$ on $A=\pi_nBG$ determines a homomorphism $\pi_0G\to \Aut(A)$, and you can "restrict" along this homomorphism to get a pullback square
\begin{CD}
     P_{n} @>>> B\pi_0G\\
     @VpVV        @VVqV\\
     P_{n-1} @>>> K(A,n+1)_{h\pi_0G}
\end{CD}