Let $BG$ denote the classifying space of a finite group $G$. For which group cohomology classes $c\in H^2(G;\mathbb{Z}/2)$ does there exist a real vector bundle $E$ over $BG$ such that $w\_2(E)=c$?



Stiefel-Whitney class of an orthogonal representation
Put 
$$A=\{c\in H^2(BG;\mathbb{Z}/2): c = w\_2(V) \text{ for some } V\}$$
Here are some observations:


1. Let $V$ be a real representation with determinant $L$, so $w\_1(V)=w\_1(L)$. Put $W=V\oplus L\oplus L\oplus L$. We find that $\det(W)=1$ and $w\_2(W)=w\_2(V)$. It follows that $A=\{w\_2(W):\det(W)=1\}$. Moreover, if $\det(V)=\det(W)=1$ then $w\_2(V\oplus W)=w\_2(V)+w\_2(W)$. It follows that $A$ is a subgroup of $H^2(BG;\mathbb{Z}/2)$.
2. If $a,b\in H^1(BG;\mathbb{Z}/2)=\text{Hom}(G,O(1))$ then there are essentially unique one-dimensional representations $L,M$ with $w\_1(L)=a$ and $w\_1(M)=b$, and this gives $w\_2(L\oplus M)=ab$ It follows that $A$ contains all decomposable elements of $H^2(BG;\mathbb{Z}/2)$.
3. There is also a well-known isomorphism $H^2(BG;\mathbb{Z})=\text{Hom}(G,S^1)=\text{Hom}(G,SO(2))$. Using this, we see that if $c\in H^2(BG;\mathbb{Z}/2)$ can be lifted to $H^2(BG;\mathbb{Z})$, then it lies in $A$.
4. Let $P\colon H^2(X;\mathbb{Z}/2)\to H^m(X;\mathbb{Z}/2)$ be any natural cohomology operation that annihilates $A$ for all $G$. Using point 2 we see that $P$ is zero when $X=B(C\_2^2)=(\mathbb{R}P^\infty)^2=K(\mathbb{Z}/2,1)^2$. However, it is a standard fact that the obvious map $$H^\*(K(\mathbb{Z}/2,n);\mathbb{Z}/2)\to H^\*(B(C\_2^n);\mathbb{Z}/2)$$
is injective for all $n$. It follows from this (taking $n=2$) that $P=0$. This means that there are no primary cohomological tests that we can use to determine whether elements lie in $A$.


UPDATE:
As Mark Grant points out, one can also treat this as a problem in obstruction theory. It is probably best to organise this in terms of the Atiyah-Hirzebruch spectral sequence
$$ \widetilde{H}^p(BG;kO^q) \Longrightarrow \widetilde{kO}^{p+q}(BG), $$
with differentials
$$ d\_r\colon E\_r^{pq} \to E\_r^{p+r,q-r+1}. $$
It is a standard fact that 
\begin{align\*}
 kO^\* &= \mathbb{Z}[\eta,\mu,\lambda]/(2\eta,\eta^3,\eta\mu,\mu^2-4\lambda) \\
 &= \mathbb{Z}[\lambda]\oplus 
 \mathbb{Z}/2[\lambda]\eta \oplus
 \mathbb{Z}/2[\lambda]\eta^2\oplus
 \mathbb{Z}[\lambda]\mu 
\end{align\*}
with $|\eta|=-1$ and $|\mu|=-4$ and $|\lambda|=-8$. (In particular, these degrees are all negative, corresponding to the fact that $kO$ is a connective spectrum, so the spectral sequence is concentrated in the fourth quadrant.) A class $c\in H^2(BG;\mathbb{Z}/2)$ gives a class $c\eta^2\in E\_2^{2,-2}$. Because we are using the reduced homology version of the spectral sequence we see that $E\_r^{pq}=0$ for $p\leq 0$ so all differentials ending at $E\_r^{2,-2}$ are zero. The problem is really to understand whether the elements $d\_r(c\eta^2)$ are zero or not. Because $kO^{-3}=0$, the first possible differential is $d\_3(c\eta^2)\in H^5(BG;\mathbb{Z}).\mu$. The result of Teichner mentioned by Mark must mean that this is
$$ d\_3(c\eta^2) = \beta Sq^2(c) \mu. $$
As $kO^{-5}=kO^{-6}=kO^{-7}=0$, the next possible differential is $d\_7(c\eta^2)$, which lies in $E\_7^{9,-8}$, which is a subquotient of $H^9(BG;\mathbb{Z}).\lambda$. One would need quite a bit of detailed information to determine which subquotient. In general we have differentials $d\_r(c\eta^2)\in E\_r^{2+r,-1-r}$ for $r\in\{3,7,8,9\}\pmod{8}$.


For any particular group $G$ it is probably more efficient to just work out the representation theory and calculate the Stiefel-Whitney classes, but the spectral sequence approach sheds some interesting light on the general picture.


