TITLE: Spin manifold and the second Stiefel-Whitney class
QUESTION [18 upvotes]: We know that: 

Spin structures will exist if and only if the second Stiefel-Whitney class $w_2(M)\in H^2(M,\mathbb Z/2)$ of $M$ vanishes.

Can someone use simple words and logic to show why the above is true?
Note. More precisely, from Wikipedia: André Haefliger found necessary and sufficient conditions for the existence of a spin structure on an oriented Riemannian manifold (M,g). The obstruction to having a spin structure is certain element [k] of $H^2(M,\mathbb{Z}/2)$. For a spin structure the class [k] is the second Stiefel-Whitney class $w_2(M)\in H^2(M,\mathbb{Z}/2)$ of M. Hence, a spin structure exists if and only if the second Stiefel-Whitney class $w_2(M)\in H^2(M,\mathbb Z/2)$ of M vanishes. 
A. Haefliger (1956). "Sur l’extension du groupe structural d’un espace fibré". C. R. Acad. Sci. Paris 243: 558–560.

REPLY [9 votes]: The situation is very simple, actually.
Recall that $Spin(n)$ is the 2-fold cover of $SO(n)$, i.e. we have a short exact sequence $1\to\mathbb Z/2\to Spin(n)\to SO(n)\to1$. It induces a cohomology exact sequence
$$\require{AMScd}
\begin{CD}
H^1(X,\underline{Spin}(n)) @>>> H^1(X,\underline{SO}(n)) @>>> H^2(X;\mathbb Z/2)\\
@| @| @|\\
\operatorname{Vect}_{Spin}(X) @>>> \operatorname{Vect}_{SO}(X) @>{w_2}>> H^2(X;\mathbb Z/2)
\end{CD}
$$
(where $\underline G$ is the sheaf of $G$-valued functions on $X$ and cohomology are Čech cohomology) — i.e. an $SO$-structure lifts to a $Spin$-structure iff some class in  $H^2(X;\mathbb Z/2)$ is zero (and as a free bonus we see that any two liftings differ by an element of $H^1(X;\mathbb Z/2)$).
(Of course, we can get even more down to earth by working explicitly with cocycles and not even mentioning sheaves and Čech cohomology.)
Now this obstruction is some mod 2 characteristic class. But actually there is only one such class in $H^2(BSO)$, so it coincides with usual $w_2$.