Consider the following diagram: $$ \begin{array} & & & F & \to & * \\ & & \downarrow & & \downarrow\\ X & \overset f\to & E & \overset g\to & B \end{array} $$ where the right square is a homotopy pullback square. The map $f$ lifts to $F$ if and only if the composed map $g \circ f$ is $0$-homotopic. If $B = K(\mathbb Z,n)$ it translates to vanishing of the class $f^*g^*([1]) \in H^n(X)$.
Now, to each homotopy from $g \circ f$ to $0$, we can associate a lift of $f$ to $F$ (constructively). My question is how are (the homotopy classes of) these lifts classified? It seems that they are classified by homotopy classes of homotopies from $g \circ f$ to $0$, but I think there is an analogic homologic description for the case of $B = K(\mathbb Z,n)$. For example, if $E = \mathcal BSO(n)$, $B = K(\mathbb Z/2,2)$, $F = \mathcal BSpin(n)$ (with $g$ being the second Stiefel-Whitney class), these lifts are classified by the elements of $H^1(X,\mathbb Z/2)$, or homotopy classes of maps from $X$ to $K(\mathbb Z/2,1)$. So where does this classification come from in this picture?
(Maybe it comes somehow from the fibre sequence $\Omega B \to F \to E \to B$?)
In your setting, lifts are classified by nullhomotopies of the composite map $X \to B$. If any such nullhomotopy exists, the space of nullhomotopies is a torsor over the space of maps $X \to \Omega B$. (You can ask a more general question where $F \to E$ isn't itself a homotopy fiber and the answer is more complicated.)
In your example, $B = B^2 \mathbb{Z}_2$, so $\Omega B = B \mathbb{Z}_2$, and we get that isomorphism classes of spin structures are a torsor over $H^1(X, \mathbb{Z}_2)$ (they cannot be identified with $H^1(X, \mathbb{Z}_2)$ until you fix a choice of spin structure). Similarly, isomorphism classes of orientations are a torsor over $H^0(X, \mathbb{Z}_2)$.