The first Stiefel-Whitney class is zero if and only if the bundle is orientable

Consider the short exact sequence of groups (note that I use $O(1) \cong \mathbb{Z}_2$) $$SO(n) \rightarrow O(n) \xrightarrow{\det} \mathbb{Z}_2.$$ This induces an exact sequence $$[X, BSO(n)] \rightarrow [X, BO(n)] \xrightarrow{(B\det)_*} [X, B\mathbb{Z}_2].$$

The real rank $n$ bundle $\eta$ is classified by the map $f_\eta \in [X, BO(n)]$. We want to show that it lifts to an element in $[X, BSO(n)]$. Then it will be a $SO(n)$-bundle and hence orientable. By exactness, to show that it lifts is to show that $(B\det)_* (f_\eta) = 0$.

Consider the commutative square $$\begin{array}{ccc} [BO(n),BO(n)] & \rightarrow & [BO(n), B\mathbb{Z}_2] \cong H^1(BO(n);\mathbb{Z}_2) \\ \downarrow & & \downarrow \\ [X, BO(n)] & \rightarrow & [X, B\mathbb{Z}_2] \cong H^1(X;\mathbb{Z}_2) \end{array}$$ The vertical maps are $f_\eta^*$ and the horizontal maps are $(B\det)_*$. Trace the image of the identity $\operatorname{id}_{BO(n)}$ through the square. By definition of the Stiefel-Whitney class from Cohen's notes, $(B\det)_*(\operatorname{id}_{BO(n)}) = w_1 \in H^1(BO(n);\mathbb{Z}_2)$, so going right and then down gives $$f_\eta^*(B\det)_*(\operatorname{id}_{BO(n)}) = f_\eta^*(w_1) =: w_1(\eta).$$ On the other hand, going down and then right gives $$(B\det)_*f_\eta^*(\operatorname{id}_{BO(n)}) = (B\det)_* (f_\eta).$$

So $\eta$ is orientable iff $(B\det)_*(f_\eta) = w_1(\eta) = 0$.