TITLE: liftings of principal bundles
QUESTION [7 upvotes]: I would like to know what structure has the category of liftings of a principal bundle. Let me be more precise. 
Fix $k$ an algebraically closed field and $X$ a smooth projective variety over it (for eg. a curve) as well as a short exact sequence of smooth connected groups
$1\to K\to G\stackrel{\pi}{\to} H\to 1$ 
(if one prefers one can work aver $\mathbb{C}$ and take the groups to be connected complex Lie groups). Since we're dealing with principal bundles pick your favourite topology, say $\tau$ (fpqc, etale, classical analytic - I hope that the answer will not depend in an essential way on this).
Now let us also fix $F_H$ an $H$-bundle on $X$. I'm interested in understading the category $\mathcal{K}_{F_H}$ of liftings of $F_H$ to $G$ (it is a stackover $X$, right?). 
This is defined as follows:
for an $X$-scheme $f:T\to X$ we have:
objects: pairs $(E,\alpha)$ where $E$ is a $G$-bundle on $T$ and $\alpha:\pi_*(E)\to f^*(F_H)$ an isomorphism of $H$-bundles.
morphisms: from a pair $(E,\alpha)$ to $(E',\alpha')$ are isomorphisms of $G$-bundles $u:E\to E'$ that are compatible with $\alpha$ and $\alpha'$, i.e. $\alpha' \pi_*(u) = \alpha$.
In case $K=\ker(\pi)$ is abelian $H$ acts naturally by conjugation on $K$ and one can form the following group scheme over $X$: $K_{F_H} = F_H\stackrel{H}{\times}K$.
One can see rather easily (for e.g. using local charts) that $\mathcal{K}_{F_H}$ is a gerbe over $X$ which is, locally on $X$, isomorphic to $BK_{F_H}\times X$.
The obstruction of $F_H$ to have a lift to a $G$-bundle is an element $\xi\in H^2_{\tau}(X,K_{F_H})$. Moreover, if $\xi=0$ the gerbe is trivial and hence the stack $\mathcal{K}_{F_H}$ is equivalent to the stack of $K_{F_H}$-bundles on $X$.
I hope I haven't messed things up yet.
My question is: what if $K$ is not abelian? then there's no natural action of $H$ on $K$ (even if the sequence is split the conjugation action depends on the splitting). Where lives the obstruction of lifting an $H$-bundle? And, what interests me more actually, what is the structure of the category of liftings of $F_H$ to $G$ once one knows it has a lift?
I'm pretty sure the answer should be in Giraud's book somewhere but I find it quite hard to read so I'm having troubles detecting the right place to look. Any references or comments would be helpful.

REPLY [6 votes]: The broad outlines of how this business works don't depend on the fact that you're working with varieties so let me work with spaces instead, by which I mean homotopy types. 
Let $f : X \to BG$ be a principal bundle and let $BH \to BG$ be a map along which you'd like to lift. Then the space of lifts of $f$ to $BH$ (up to homotopy) is precisely the space of (homotopy) sections of the pullback $X \times_{BG} BH$, or equivalently the space of sections of the $G/H$-bundle associated to $f$. (Here by $G/H$ I mean the homotopy fiber of $BH \to BG$, which may or may not be the actual quotient $G/H$, whatever that means in your setting.)
The nicest case is when $BH \to BG$ is itself a homotopy fiber, or equivalently when it fits into a fiber sequence
$$\Omega Y \to BH \to BG \to Y$$
for some space $Y$ (which must necessarily deloop $G/H$; in this case the associated $G/H$-bundle is a "principal $\Omega Y$-bundle"). Then the space of lifts of $f$ to $BH$ is, by the universal property of the homotopy fiber, precisely the space of nullhomotopies of the composite map $X \to BG \to Y$. In the very nicest cases $Y$ is an Eilenberg-MacLane space.
In particular, if $G, H$ fit into a short exact sequence
$$K \to H \to G$$
then $BK, BH, BG$ fit into a fiber sequence
$$BK \to BH \to BG.$$
If $K$ is not only abelian but central in $H$, then this fiber sequence deloops to a fiber sequence
$$BK \to BH \to BG \to B^2 K$$
and so we can take $Y = B^2 K$, in which case the existence of a nullhomotopy of the composite $X \to BG \to Y$ is equivalent to the corresponding cohomology class in $H^2(X, K)$ vanishing. If $K$ is abelian but not central then this cohomology group needs to be taken with local coefficients. But sometimes $Y$ is more complicated than this. For example, if $G = \text{Spin}$ and $H = \text{String}$ then $Y = B^4 \mathbb{Z}$ and the existence of a lift is controlled by a cohomology class $\frac{p_1}{2} \in H^4(X, \mathbb{Z})$. 
In general, though, $G/H$ just isn't a loop space, and so can't be delooped, which means that $Y$ doesn't exist and the obstruction theory gets harder. The obstructions are a sequence of classes in cohomology $H^{k+1}(X, \pi_k(G/H))$ with local coefficients, each of which is only well-defined provided that the previous one vanishes. A typical case here is $G = O(2n), H = U(n)$.