I am trying to classify the extensions of $\mathbb{Z}/2$ by $\mathbb{Z}$, that is, all $G$ that fits in the exact sequence
$$0\to \mathbb{Z}\to G\to \mathbb{Z}/2\to 0.$$
These extensions (up to equivalence) are in bijection with $\text{Ext}_{\mathbb{Z}}^1(\mathbb{Z}/2,\mathbb{Z})=R^1G(\mathbb{Z})=H^1(G(I_{\bullet}))$, where $G$ is the left exact additive functor $G(B)=\text{Hom}_\mathbb{Z}(\mathbb{Z}/2,B)$, $R^iG$ its right derived functors, $I_{\bullet}$ an injective resolution of $\mathbb{Z}$.
To compute $\text{Ext}_{\mathbb{Z}}^1(\mathbb{Z}/2, \mathbb{Z})$, first choose an arbitrary injective resolution of $\mathbb{Z}$, $0 \to \mathbb{Z}\to \mathbb{Z}\to 0 \to 0 \to \dotsb$. We then get a cochain complex by applying $G$
$$0\to \text{Hom}_\mathbb{Z}(\mathbb{Z}/2,\mathbb{Z})\to \text{Hom}_\mathbb{Z}(\mathbb{Z}/2,0)\to \text{Hom}_\mathbb{Z}(\mathbb{Z}/2,0)\to \dotsb.$$
$\text{Ext}_{\mathbb{Z}}^1(\mathbb{Z}/2, \mathbb{Z})$ is precisely the first cohomology group of this complex. Every component is trivial, so the first cohomology group is trivial. There is only one such group extension up to equivalence.
But this seems to be wrong because Extensions of $\mathbb{Z}$ by $\mathbb{Z}_2$ here it says there are two inequivalent extensions. I am not sure where I made a mistake. Thank you.
Let's get this one off the unanswered heap. First, a little commentary: while free modules have many good properties, injectivity is not always one of them, and this particular example is a valuable one to keep at hand.
Indeed, suppose that $A$ is an injective abelian group. Then for every natural number $n$ and any map $f \colon \mathbb{Z} \to A$, there must be a morphism $g \colon \mathbb{Z} \to A$ such that $f = g \circ \mu_{n}$, where $\mu_{n} \colon \mathbb{Z} \to \mathbb{Z}$ is multiplication-by-$n$. Putting $a = f(1) \in A$, we see that $g$ must satisfy $g(n) = a$, and in particular, we must have $g(1) = y \in A$ such that $ny = a$. Since any element $a \in A$ defines a morphism $\mathbb{Z} \to A$ via the assignment $1 \mapsto a$, this shows that $A$ is necessarily divisible if it is injective. In particular, $\mathbb{Z}$ cannot be injective as a $\mathbb{Z}$-module.
As for your question, as long as you're willing to accept that divisible abelian groups are injective, you can see that the short exact sequence
$$0 \to \mathbb{Z} \to \mathbb{Q} \to \mathbb{Q}/\mathbb{Z} \to 0$$
(where the first map is inclusion and the second map is projection) is an injective resolution of $\mathbb{Z}$ as a $\mathbb{Z}$-module. In this case, your $\operatorname{Ext}$ complex looks like
$$0 \to \operatorname{Hom}_{\mathbb{Z}}(\mathbb{Z}/2\mathbb{Z}, \mathbb{Q}) \to \operatorname{Hom}_{\mathbb{Z}}(\mathbb{Z}/2\mathbb{Z}, \mathbb{Q}/\mathbb{Z}) \to 0 \to \cdots .$$
Of course, $\operatorname{Ext}^{1}_{\mathbb{Z}}(\mathbb{Z}/2\mathbb{Z}, \mathbb{Z})$ is the cohomology at the first position of this complex. For any abelian group $A$ and any natural number $n$, set $A[n]$ to be the subgroup of $A$ of torsion elements of order dividing $n$. There is an isomorphism $\operatorname{Hom}_{\mathbb{Z}}(\mathbb{Z}/n\mathbb{Z}, A) \to A[n]$ sending $f \in \operatorname{Hom}_{\mathbb{Z}}(\mathbb{Z}/n\mathbb{Z}, A)$ to $f([1]_{n})$. Hence, we have $\operatorname{Hom}_{\mathbb{Z}}(\mathbb{Z}/2\mathbb{Z}, \mathbb{Q}) = 0$ and $\operatorname{Hom}_{\mathbb{Z}}(\mathbb{Z}/2\mathbb{Z}, \mathbb{Q}/\mathbb{Z}) \cong \mathbb{Z}/2\mathbb{Z}$, which gives the desired calculation.