It all relies on the $2$-fold covering map $p: S^1\to S^1, z\mapsto z^2$.
Indeed suppose there is a $\mathbb Z/2$-map $g:X\to S^1$, then $X\to S^1\overset{p}\to S^1$ is $\mathbb Z/2$-equivariant , so factors through $\overline X$, and we get $\overline X\to S^1$ such that the following diagram commutes :
$$\require{AMScd}\begin{CD} X @>g>> S^1 \\
@VqVV @VpVV \\
\overline X @>f>> S^1\end{CD}$$
and then $f_* : \pi_1(\overline X)\to \pi_1(S^1)\cong \mathbb Z$ satisfies the condition (indeed, clearly $f_*q_*\pi_1(X) \subset 2\mathbb Z$; and conversely suppose $f_*\gamma \in 2\mathbb Z$, and let $\gamma : I\to \overline X$ be the corresponding map.
Then $\gamma : I\to \overline X$ may be lifted to a path (which is not a priori a loop) $\delta : I\to X$. But now $q(\delta(0))= q(\delta(1))$, so either $\delta(0) = \delta(1)$, in which case we have nothing to say ($\delta$ is a loop, and $q_*\delta = \gamma$), or $\delta(0) = \sigma \delta(1)$ (where $\sigma \in\mathbb Z/2$ is the generator); in which case $g\delta(0) = \sigma g\delta(1)$, and so they are different.
But they're the endpoints of $g\delta$ which is a lift $I\to S^1$ of $f\circ \gamma : I\to S^1$, and such a lift is necessarily a loop, because $f_*\gamma \in 2\mathbb Z = p_*\pi_1(S^1)$.
This is absurd, so $\delta(0) = \delta(1)$ and therefore $\gamma \in q_*\pi_1(X)$.
Conversely, suppose you have such a map $f: \pi_1(\overline X)\to \mathbb Z$. Then since $S^1$ is a $K(\mathbb Z,1)$, that is, it has no higher homotopy, this map can be used to produce a map $\tilde f : \overline X\to S^1$ which is such that $\tilde f_* = f$.
Then we can compose it to get $X\to \overline X\to S^1$, and the image of $\pi_1(X)$ is $\subset 2\mathbb Z$ by assumption. It follows by general covering theory that this yields a lift, and so a commutative diagram :
$$\begin{CD} X @>g>> S^1 \\
@VqVV @VpVV \\
\overline X @>\tilde f>> S^1\end{CD}$$
Now we just need to show that the top map is a $\mathbb Z/2$-map (note that we still haven't used that $f^{-1}(2\mathbb Z) = \pi_1(X)$, we only used one inclusion, so we'll need to use the second inclusion).
Let $x\in X$ and let $y = \sigma x$. Then $p(g(y)) = \tilde f(q(y)) = \tilde f(q(x)) = p(g(x))$, so $g(y)= g(x)$ or $\sigma g(x)$. We just need to show that the former is not possible.
Let $\delta$ be a path in $X$ from $x$ to $y$ ($X$ is connected), and consider $q\circ \delta$ : it's a loop in $\overline X$, let's call it $\gamma$. Then $f(\gamma)\in \pi_1(S^1)\cong \mathbb Z$ is not in $2\mathbb Z$. Indeed if it were, then $\gamma$ would be in $q_*\pi_1(X)$, which it isn't, as $x\neq y$ (the action on $X$ is free, by assumption).
Therefore $f(\gamma)$ does not lift to a loop along $p : S^1\to S^1$, and in particular, since $g\circ \delta$ is a path that lifts $f\circ \gamma$, it follows that $g\circ \delta$ cannot be a loop, i.e. $g(\delta(0))\neq g(\delta(1))$, i.e. $g(x) \neq g(y)$.
By what we said earlier, it follows that $g(y) = \sigma g(x)$, i.e. $g$ is a $\mathbb Z/2$-map, and we are done.