Show $H_2(M, \mathbb{Z}) = \mathbb{Z^r}$ if $M$ is orientable, $\mathbb{Z^{r-1}} \oplus \mathbb{Z_2}$ if nonorientable I'm trying to solve this problem from Hatcher 3.3.24.
Let $M$ be a closed connected 3-manifold, and write $H_1(M, \mathbb{Z})$ as $\mathbb{Z^r} \oplus T$ where $T$ is torsion. Show that $H_2(M, \mathbb{Z})$ is $\mathbb{Z^r}$ if $M$ is orientable or $\mathbb{Z^{r-1}} \oplus \mathbb{Z_2}$ if $M$ is not orientable. In particular $r \geq 1$ if $M$ is not orientable. Using exercise 6 construct examples showing there are no other restrictions on the homology groups of closed 3-manifolds. (In the nonorientable case consider the manifold $N$ obtained from $S^2 \times I$ by identifying $S^2 \times \{0\}$ with $S^2 \times \{1\}$ via a reflection of $S^2$.)
I think I've solved the first part, here's my proof: 
First note the following theorem: If $M$ is a closed connected and orientable n-manifold then $H_n(M, \mathbb{Z}) = \mathbb{Z}$ and $Tors(H_{n-1}(M, \mathbb{Z})) = 0$. If nonorientable, then $H_n(M, \mathbb{Z}) = 0$, $Tors(H_{n-1}(M, \mathbb{Z})) = \mathbb{Z_2}$.
Now note by Poincare duality and UCT we have that $H_2(M) \cong H^1(M) \cong \mathbb{Z^r} \oplus T_0 \cong \mathbb{Z^r}$. 
In the nonorientable case consider the exact sequence:
$0 \longrightarrow H_2(M) \longrightarrow H_1(M) \longrightarrow H_0(M) \longrightarrow 0$
But we know $H_1(M) = \mathbb{Z^r} \oplus Z_2$ from the earlier theorem and $H_0(M) = \mathbb{Z}$. 
Therefore $H_2(M) \cong ker(\mathbb{Z^r} \oplus Z_2 \rightarrow \mathbb{Z}) \cong \mathbb{Z^{r-1}} \oplus \mathbb{Z_2}$. 
For the rest of the question I'm quite lost. 
 A: To correct your non-orientable case: consider the Euler characteristic of $M$ which vanishes since it has odd dimension. Therefore $b_2(M)= b_1(m)-b_0(M) = r-1$ for the free part and by the theorem you mentioned it follows that $H_2(M)=\mathbb Z^{r-1} \oplus \mathbb Z/2$.
If you explain to me what you mean by the second part with "restrictions" I will add the rest of my answer here.
Edit
So I wonder why you bothered calculating $H_2(S^2\times S^1)$, after you calculated $H_2(M)$ of any 3-manifold (if you know $H_1$ but you know it since $\pi_1$ is multiplicative under products). Note that the twisted 2-sphere bundle $P$ over $S^1$ as well as the trivial 2-sphere bundle (the product) give you both $H_1(P)=H_1(S^2\times S^1)=\mathbb Z$, since $S^2$ is simply connected. Now if you can show that $P$ is non orientable (for example $S^2\times S^1$ is an orientation covering). Then you know $H_2(P)=\mathbb Z/2$ by the exercise and also $H_2(S^2\times S^1)=\mathbb Z$. Now consider connected sums of those spaces with rank 1 free abelian fundamental groups. (and note that you can show the "Except when"-statement from exercise 6 of the same chapter for 3-manifolds now with this exercise) Have fun!
A: An alternate method for computing the homology of $N$ come from the perspective that $N$ is a mapping torus of $S^2$. Hatcher has an exact sequence on page 151 which should be enough to get the homology of $N$.
