TITLE: Cohomology of BG, G non-connected Lie group, and spectral sequence relating to classifying space of connected component of the identity
QUESTION [6 upvotes]: Suppose $G$ is a Lie group, with $\pi_0(G)$ not necessarily finite, but might as well assume $G_0$, the connected component of the identity, is compact.
In the case that $\pi_0(G)$ is finite, then we know that there is an injection $H^*(BG,\mathbb{Q})\to H^*(BG_0,\mathbb{Q})$, and this can apparently be seen via a spectral sequence argument, using the fact that the rational cohomology of $B\pi_0(G)$ is concentrated in degree zero. So this is some kind of Leray–Serre spectral sequence argument on either $\pi_0(G)\to BG_0\to BG$ or $BG_0\to BG\to B\pi_0(G)$ (and I suspect the latter), probably using the degeneration and some kind of "edge homomorphism is injective" argument.
I suspect that in the case that we know something strong about the rational cohomology of $B\pi_0(G)$, then we might be able to say something in the case where $\pi_0(G)$ is not finite.
Unfortunately my spectral sequence knowledge is limited, and I can't find a treatment of spectral sequences that seems general enough to deal with this setup in general (namely non-simply-connected base, and possibly non-connected fibre, plus non-finiteness issues, depending on which fibration is used).
Is my intuition correct, that $H^*(B\pi_0(G),\mathbb{Q}) = H^0(B\pi_0(G),\mathbb{Q})$ can let us conclude something about how the cohomology of $BG$ relates to that of $BG_0$?
Also, what would be a good reference that covers a general-enough version of the relevant spectral sequence?

REPLY [8 votes]: Think about the case where $\pi_0(G)=\mathbb{Z}$, so $B(\pi_0(G))=S^1$, so we have a fibre bundle $BG_0\to BG\to S^1$.  In this case $G$ is always a semidirect product formed using an automorphism $\alpha$ of $G_0$.  By considering the preimages of the the complements of two points in $S^1$, we can express $BG$ as $U\cup V$, where $U$ and $V$ are each open and homotopy equivalent to $BG_0$, and $U\cap V$ is homotopy equivalent to $BG_0\amalg BG_0$.  This gives a Mayer-Vietoris sequence.  If we set up the identifications carefully we find that $\alpha^*$ appears in one of the Mayer-Vietoris maps, and we deduce that there is a short exact sequence $C^{*-1}\to H^*(BG)\to K^*$, where $K^*$ and $C^*$ are respectively the kernel and cokernel of $\alpha^*-1\colon H^*(BG_0)\to H^*(BG_0)$.  All this is valid integrally as well as rationally.
For more general $\pi_0(G)$, we have a spectral sequence
$$ H^p(\pi_0(G);H^q(BG_0)) \Longrightarrow H^{p+q}(BG). $$
Note that the $E_2$ term involves group cohomology of the group $\pi_0(G)$ with coefficients in the module $H^*(BG_0)$, which typically has nontrivial action of $\pi_0(G)$.  This is the same as the cohomology of the space $B\pi_0(G)$ with coefficients in a local system that typically has nontrivial twisting.
In the case $\pi_0(G)=\mathbb{Z}$ the only group cohomology groups are $E_2^{0q}=K^q$ and $E_2^{1q}=C^q$.  The differentials are like $d_r\colon E_r^{pq}\to E_r^{p+r,q-r+1}$ so there is no room for them to be nonzero.  Thus $E_\infty=E_2$ and we recover the picture in the first paragraph above.
On the other hand, if $\pi_0(G)$ is finite and we use rational coefficients then $H^p(\pi_0(G);H^q(BG_0))=0$ for $p>0$ and the spectral sequence collapses to an isomorphism $H^n(BG)=H^n(BG_0)^{\pi_0(G)}$.
Note also that $G$ could just be $G_0\times\Gamma$ for an arbitrary discrete group $\Gamma=\pi_0(G)$.  In this case $BG=BG_0\times B\Gamma$, and the Kan-Thurston Theorem tells us that $H^*(B\Gamma)$ can be essentially anything.