I am sure the answer to this question is well-known, but

It is well known that the group cohomology $H^2(G,\mathbb Z)$ classifies group extensions $0\to \mathbb Z\to E\to G\to 1$ and that for a topological space $X$ elements of $H^2(X,\mathbb Z)$ are in natural bijection with complex line bundles on $X$.

My question is thus:

What is the direct correspondence between extensions of $G$ and line bundles on $BG$?

That is, given an explicit line bundle $L$ how does one construct an explicit group extension $E$ such that the two give the same cohomology class and vice versa?

groupcohomology, while $H^2(X,\mathbb{Z})$ denotes ordinary cohomology. I'd better replace $H^2(G,\mathbb{Z})$ right away by $H^2(BG,\mathbb{Z})$. $\endgroup$