I want to find all possible $A$ in the following SES:
$$0\to \mathbb Z\to A\to Z_n \to 0$$
I know by structure theorem of finite generated abelian groups, $A\cong \mathbb Z\oplus \mathbb Z_d$. Then how can we find the relation between $d$ and $n$? What are two maps in the middle?
Since this is an exercise in Hatcher's book at the beginning section of homology theory, a solution without using Ext will be much better.
Since I don't know what we can assume, let's classify all those extensions by brute force. Since it's a problem in a chapter about homology, $A$ is probably meant to be abelian but let's go ahead and do the general case. I'll outline a proof in the form of exercises. At the end, I outline the relationship between the explicit constructions and the cohomological argument.
First, name the arrows in the exact sequence: $i: \mathbf Z \rightarrow A$ and $p: A \rightarrow \mathbf Z_n$.
Let $a = i(1)$ and let $b \in A$ such that $p(b) = 1$.
So, $$A = \langle a, b : \text{ some relations we need to find}\rangle$$
Hint: What are the images of $bab^{-1}$ and $b^n$ under $p$?.
Hint: use the relations we have so far. For the last part, recall that $a$ is the generator of a copy of $\mathbf Z$ in $A$.
Hint (so it doesn't look like magic): $s = 1$ implies $A$ abelian and the relation $b^n = a^r$ can then be rewritten as $1 = (b^{n/t}a^{-r/t})^t$. In fact, $t$ is the order of $b^{n/t}a^{-r/t}$ in $A$. Show that $b^{n/t}a^{-r/t}$ and $b^{\beta}a^{\alpha}$ generate $A$ and consider the homomorphism $\varphi: \mathbf Z \times \mathbf Z_t \rightarrow A$ given by $\varphi(1,0) = b^{\beta}a^{\alpha}$ and $\varphi(0, 1)=b^{n/t}a^{-r/t}$. It sits in the commutative diagram $\require{AMScd}$ \begin{CD} 0 @>>> \mathbf Z @>{i'}>> \mathbf Z \times \mathbf Z_t @>{p'}>> \mathbf Z_n @>>> 0\\ & @V{=\,}VV @VV{\varphi}V @VV{\, =}V \\ 0 @>>> \mathbf Z @>>{i}> A @>>{p}> \mathbf Z_n @>>> 0\end{CD}
Hint: in this case $ba^rb^{-1} = a^{-r}$ and $a^r = b^n$, so $r = 0$ and $b^n = 1$. Conclude that $A$ is isomorphic to $\mathbf Z \rtimes \mathbf Z_n$ and classify all homomorphisms $\mathbf Z_n \rightarrow \operatorname{Aut}(\mathbf Z)$. Note that $\mathbf Z$ has only two automorphisms and, by exercise 3, $n$ is even when $s = -1$.
What's going on in cohomological terms?
$\operatorname{Ext}(\mathbf Z_n, \mathbf Z)$ classifies the extensions of $\mathbf Z_n$ by $\mathbf Z$ as $\mathbf Z$-modules or, in other words, as abelian groups. To compute $\operatorname{Ext}(\mathbf Z_n, \mathbf Z)$, one would usually apply $\operatorname{Hom}(\cdot, \mathbf Z)$ to the "multiplication by $n$" sequence $$0 \rightarrow \mathbf Z \rightarrow \mathbf Z \rightarrow \mathbf Z_n \rightarrow 0$$ to get $\operatorname{Ext}(\mathbf Z_n, \mathbf Z) = \mathbf Z/n\mathbf Z$. Exercise 4 makes this equality explicit. The class of $r$ in $\operatorname{Ext}(\mathbf Z_n, \mathbf Z) = \mathbf Z/n\mathbf Z$ corresponds to the extension $\mathbf Z \times \mathbf Z_t$ with maps $p'$ and $i'$ as in the statement of exercise 4.
Non-abelian group extensions of $\mathbf Z_n$ by $\mathbf Z$ are not detected by $\operatorname{Ext}(\mathbf Z_n, \mathbf Z) = H^2(\mathbf Z_n, \mathbf Z)$. To detect more general extensions, one could look, for example, at $H^3$ (see here). IMO Exercise 5 is a more down to earth way of treating this case.