Which elements of $H^2(M,\mathbb{Z}/2)$ are the $w_2(E)$ for a real bundle $E$? Any element of $H^1(M,\mathbb{Z}/2)$ is the $w_1(E)$ of a real line bundle $E$ over $M$. 
I wonder how to characterize (probably using the Steenrod squares) which elements of $H^2(M,\mathbb{Z}/2)$ are the $w_2(E)$ of a real vector bundle $E$ over $M$. 
Considering tensor products and tensoring by line bundles, it is clear that such elements form a subgroup of $H^2(M,\mathbb{Z}/2)$. I know that any element killed by $Sq^1$ is realizable this way, since if $Sq^1 v=0$ for $v\in H^2(M,\mathbb{Z}/2)$ then $v$ is a reduction of an element $c$ in $H^2(M,\mathbb{C})$. Then one can pick a complex line bundle whose $c_1$ is $c$, which always exists...
 A: The other answers consider the case where the bundle in question is orientable. It's then natural to ask if $v \in H^2(M; \mathbb{Z}/2)$ can be realised as $w_2(E)$ for some vector bundle $E$, is it necessarily realised as $w_2(E')$ for some orientable vector bundle $E'$? It turns out that the answer is yes!
To see this, let $L$ denote the determinant line bundle of $E$ and note that $w_1(E) = w_1(L)$. Consider the vector bundle $E' := (E\oplus L\oplus\varepsilon^k)\otimes L$ where $k$ is chosen such that $\operatorname{rank}(E\oplus L\oplus\varepsilon^k) = 4p + 2$ for some $p$. Using the formulae for the first and second Stiefel-Whitney classes of a tensor product (see this note for example), we have
\begin{align*}
w_1(E') &= w_1((E\oplus L\oplus\varepsilon^k)\otimes L)\\ 
&= \operatorname{rank}(L)w_1(E\oplus L\oplus\varepsilon^k) + \operatorname{rank}(E\oplus L\oplus\varepsilon^k)w_1(L)\\ 
&= w_1(E) + w_1(L) + (4p+2)w_1(L)\\
&= 0
\end{align*}
and
\begin{align*}
w_2(E') &= w_2((E\oplus L\oplus\varepsilon^k)\otimes L)\\
&= \binom{1}{2}w_1(E\oplus L\oplus\varepsilon^k)^2 + \binom{4p+2}{2}w_1(L)^2 + 1^2w_2(E\oplus L\oplus\varepsilon^k)\\
&\quad\,  + (4p+2)^2w_2(L) + (4p+1)w_1(E\oplus L\oplus\varepsilon^k)w_1(L)\\
&= 0 + w_1(L)^2 + w_2(E\oplus L) + 0 + w_1(E\oplus L)w_1(L)\\
&= w_1(L)^2 + w_2(E) + w_1(E)w_1(L) + w_2(L) + (w_1(E) + w_1(L))w_1(L)\\
&= w_1(L)^2 + w_2(E) + w_1(L)^2 + 0 + 0\\
&= w_2(E).
\end{align*}
Therefore, if $E$ is a vector bundle with $w_2(E) = v$, then $E'$ is an orientable vector bundle with $w_2(E') = v$.
This observation can be used to show that the set of cohomology classes which can be realised as $w_2(E)$ for some vector bundle $E$ is a subspace of $H^2(M; \mathbb{Z}/2)$. The only condition that needs to be verified is that the sum of realisable cohomology classes is again realisable. If $v_1$ and $v_2$ are realised, then by the above, we can find orientable bundles $E_1$ and $E_2$ such that $w_2(E_i) = v_i$. By taking the direct sum with a trivial bundle if necessary, we can arrange for $E_1$ and $E_2$ to have odd ranks $m_1$, $m_2$ respectively. It then follows from the same tensor product formula that
$$w_2(E_1\otimes E_2) = m_2^2w_2(E_1) + m_1^2w_2(E_2) = w_2(E_1) + w_2(E_2) = v_1 + v_2,$$
so $v_1 + v_2$ is realisable.
A: To elaborate on Mark Grant's answer, and sticking to the oriented case, there is a fibration sequence (all of infinite loop maps)
$$ BSpin \rightarrow BSO \xrightarrow{w_2} K(\mathbb Z/2,2) \xrightarrow{d} BBSpin$$
The homotopy groups of $BBSpin$ are known from Bott periodicity: $\pi_5(BBSpin) = \mathbb Z$, $\pi_9(BBSpin) = \mathbb Z$, $\pi_{10}(BBSpin) = \mathbb Z/2$, etc.
So a first obstruction to lifting through $w_2$ will be the composite 
$$ K(\mathbb Z/2,2) \xrightarrow{d} BBSpin \rightarrow K(\mathbb Z,5)$$
which identifies as $\beta Sq^2$ as noted above.  The next obstruction would live in 9 dimensional cohomology, etc., and so these obstructions would vanish on spaces of dimension 8 or less.
Finally, I believe the answer doesn't change if one considers nonoriented bundles, because $BO \xrightarrow{w_2} K(\mathbb Z/2,2)$ factors through $BSO \xrightarrow{w_2} K(\mathbb Z/2,2)$, if I am not mistaken.
A: This is an obstruction theory problem; you regard $v\in H^2(M;\mathbb{Z}/2)$ as a homotopy class of maps $v: M\to K(\mathbb{Z}/2,2)$, then ask if $v$ lifts through the universal Stiefel-Whitney class $w_2:BSO\to K(\mathbb{Z}/2,2)$. The first obstruction is $\beta(v^2)\in H^5(M;\mathbb{Z})$, as mentioned by Theo Johnson-Freyd in the comments, coming from the fact that $w_2^2(E)$ is the mod $2$ reduction of $p_1(E)$ for any real vector bundle $E$. The secondary obstruction is more subtle (it will have indeterminacy given by a choice of integral lift of $v^2$, for example) but I would be surprised if there is no information on it in the literature.
I think the state of the art on this question might still be Teichner's paper
Teichner, Peter, 6-dimensional manifolds without totally algebraic homology, Proc. Am. Math. Soc. 123, No. 9, 2909-2914 (1995). ZBL0858.57033.
Teichner shows that if $\operatorname{dim}(M)\le 5$, then $\beta(v^2)$ is the only obstruction to $v$ being $w_2(E)$ for some real vector bundle $E$. On the other hand, he constructs examples of manifolds in all dimensions $n\ge 6$ with classes $v\in H^2(M;\mathbb{Z}/2)$ such that $\beta(v^2)\neq 0$. He also shows that any $v\in H^2(M;\mathbb{Z}/2)$ which is Poincaré dual to a codimension $2$ submanifold $N\subseteq M$ is $w_2(E)$ for some $E$.
An older paper which also seems relevant is 
Suzuki, H., On the realization of the Stiefel-Whitney characteristic classes by submanifolds, Tohoku Math. J., II. Ser. 10, 91-115 (1958). ZBL0107.17001. 
