You're asking two questions: implicitly, you're asking how to solve Hatcher's 3.2.5, and explicitly, you're asking about a particular solution from this site. I'm going to address the first of these, not the second.
Let's start with this: for any topological space $X$ and any homomorphism of commutative rings $R \to S$, there is an induced map $H^*(X;R) \to H^*(X;S)$ which is compatible with cup products. We apply this to the ring map $\mathbb{Z}/2k \to \mathbb{Z}/2$. Let's look at cellular cochains:
$$
\begin{array}{cccccccccc}
\xleftarrow{2} & \mathbb{Z}/2k & \xleftarrow{0} & \mathbb{Z}/2k & \xleftarrow{2} & \mathbb{Z}/2k & \xleftarrow{0} & \mathbb{Z}/2k & \xleftarrow{} & 0 \\
& \downarrow & & \downarrow & & \downarrow & & \downarrow \\
\xleftarrow{2} & \mathbb{Z}/2 & \xleftarrow{0} & \mathbb{Z}/2 & \xleftarrow{2} & \mathbb{Z}/2 & \xleftarrow{0} & \mathbb{Z}/2 & \xleftarrow{} & 0 \\
\end{array}
$$
The induced map on cohomology:
$$
\begin{array}{ccccccccccc}
\mathbb{Z}/2 & & \mathbb{Z}/2 & & \mathbb{Z}/2 & & \mathbb{Z}/2k & & 0 \\
\downarrow & & \downarrow & & \downarrow & & \downarrow \\
\mathbb{Z}/2 & & \mathbb{Z}/2 & & \mathbb{Z}/2 & & \mathbb{Z}/2 & & 0 \\
\end{array}
$$
We know that $H^*(\mathbb{R}P^\infty; \mathbb{Z}/2) \cong \mathbb{Z}/2[x]$ with $x \in H^1$. Let $\alpha$ and $\beta$ be the nonzero elements in $H^1(\mathbb{R}P^\infty; \mathbb{Z}/2k)$ and $H^2(\mathbb{R}P^\infty; \mathbb{Z}/2k)$, respectively. We immediately see that $2\alpha=0$ and $2\beta=0$.
Each vertical map in the cochain diagram sends 1 to 1, and $\alpha$ is represented by $k \in \mathbb{Z}/2k$, so $\alpha \mapsto kx$. The element $\beta$ is represented by $1 \in \mathbb{Z}/2k$, so $\beta \mapsto x^2$. So if $k$ is odd, we find that $\alpha \mapsto x$ and $\alpha^2 = \beta = k \beta$. If $k$ is even, then $\alpha \mapsto 0$ so $\alpha^2 \mapsto 0$. On the other hand, $\beta \mapsto x^2 \neq 0$, so $\alpha^2 \neq \beta$. This means that $\alpha^2 = 0 = k\beta$.
Similar reasoning shows that $b^n \mapsto x^{2n}$ and $\alpha \beta^n \mapsto kx^{2n+1}$ for each $n$.
Edit: maybe some more work is required to fully analyze $\alpha \beta^n$ when $k$ is even. That is, you know that $\alpha \beta^n \mapsto 0$ in this case, so you have to explain why $\alpha \beta^n$ is actually nonzero.