Classification of line bundles by second cohomology of a manifold In the book Loop spaces, Characteristic classes and geometric quantization by Brylinski I see following result when trying to motivate geometric description of $H^3(M,\mathbb{Z})$.

$H^2(M,\mathbb{Z})$ is the group of isomorphism classes of line bundles over $M$.

I guess they mean there is a natural isomorphism. 
Can some one give a rough idea of what obvious second cohomology class we can think of given a line bundle over $M$ and what line bundle can we think of given an arbitrary second cohomology class. 
Intuitive comments are also welcome.
I am familiar (not the proof details) with following result:

If $G$ is a group and $M$ is a $G$-module, then the  $H^2(G, A)$ is in one-one correspondence with the set of
  equivalence classes of extensions $E$ of $M$ by $G$, in which the action of $G$ on $M$ induced by conjugation in $E$ is the same as the action defined by the $G$- module $M$.

I am expecting some intuitive explanation that looks similar to this.
 A: I think $H^2(M;\mathbb{Z})$ cannot mean the de Rham cohomology group. The coefficients are wrong. 
Anyway: $\mathbb{CP}^\infty$ is an amazing space. It is both a model for $K(\mathbb{Z},2)$ and a model of $BU(1)$. Homotopy classes into $K(\mathbb Z,2)$ is in bijection with $H^2(M;\mathbb{Z})$ (By pulling back the fundamental class) and homotopy classes into $BU(1)$ classify (complex) line bundles (by pulling back the tautological bundle). This works well with natural group structures. This gives the required isomorphism.
The cohomology class in $H^2(M;\mathbb{Z})$ corresponding to the complex line bundle is the first Chern class.  
I can recommend Milnor Stasheff "characteristic classes" for the classification of the line bundles. I can recommend Hatcher for the classification of cohomology in terms of homotopy classes into $K(\mathbb Z,n)$. 
A: Although Milnor and Stasheff is an excellent suggestion, I was also led to wonder where one would find this result in more recent textbooks.  Most ingredients are in May's "Concise introduction to algebraic topology".  Specifically, May proves on page 177 that $H^2(X;\mathbb{Z})\simeq [X,K(\mathbb{Z},2)]$.  Here $K(\mathbb{Z},2)$ is officially defined as $B^2(\mathbb{Z})$, where $B$ is the simplicial classifying space functor.  However, on page 121 May gives a sequence of exercises about Eilenberg-MacLane spaces.  As a special case, we find that whenever $Z$ is a connected CW complex with $\pi_2(Z)=\mathbb{Z}$ and $\pi_i(Z)=0$ for $i\neq 2$, we have $Z\simeq K(\mathbb{Z},2)$.  In particular, it is not hard to find fibrations whose long exact sequences prove that the spaces $Z=BU(1)$ and $Z=\mathbb{C}P^\infty$ have the required homotopy groups, so they are both homotopy equivalent to $K(\mathbb{Z},2)$.  May also proves on page 197 that the set of isomorphism classes of line bundles on $X$ is naturally identified with $[X,BU(1)]$.  
A: For what it is worth, here is another approach, in the algebraic geometry style. By taking out the zero section, complex line bundles correspond bijectively to $\mathbb{C}^*\!$-principal bundles on $M$. Such bundles are classified by the cohomology group $H^1(M, \mathcal{O}_M^*)$, where $\mathcal{O}_M$ is the sheaf of $\mathcal{C}^{\infty}$ complex-valued functions on $M$. Now there is an exact sequence of sheaves
$$0\rightarrow \mathbb{Z}\longrightarrow \mathcal{O}_M\xrightarrow{\ \mathbf{e}\ }\mathcal{O}_M^*\rightarrow 1 $$where $\mathbf{e}(f):=\exp(2\pi if)$.
This gives rise to a cohomology exact sequence 
$$H^1(M, \mathcal{O}_M)\longrightarrow H^1(M, \mathcal{O}_M^*)\xrightarrow{\ \partial \ } H^2(M,\mathbb{Z})\longrightarrow H^2(M, \mathcal{O}_M)\,.$$But since $\mathcal{O}_M$ is a fine sheaf, its higher cohomology vanishes, and $\partial $ is an isomorphism.
