TITLE: Fundamental group of the total space of an oriented $S^1$ fiber bundle over $T^2$
QUESTION [6 upvotes]: Let $M$ be the total space of an oriented $S^1$ fiber bundle over $T^2$.
Can we show the fundamental group of $M$ is nilpotent? More generally, how can we calculate the fundamental group of $M$ explicitly?

REPLY [4 votes]: Orientable circle bundles over $X$ are classified by $H^2(X; \mathbb{Z})$ via the first Chern class (or Euler class). In particular, orientable circle bundles over $T^2$ are classified by $H^2(T^2; \mathbb{Z}) \cong \mathbb{Z}$. Let $M_r$ denote the total space of the orientable circle bundle over $T^2$ with first Chern class $r$; this is what is referred to as the Euler number in Lee Mosher's answer. For $r \neq 0$, the manifolds $M_r$ and $M_{-r}$ are diffeomorphic, but have opposite orientations. Below we give a construction of the manifolds $M_r$. This is more than you ask for, but it provides a different point of view than the other answers.
For $r = 0$, we have $M_0 = T^3$ and $\pi_1(T^3) \cong \mathbb{Z}^3$ which is abelian and hence nilpotent.
For $r \neq 0$, consider the quotient $H(3, \mathbb{R})/\Gamma_r$ where
$$H(3, \mathbb{R}) = \left\{\begin{bmatrix} 1 & x & z\\ 0 & 1 & y\\ 0 & 0 & 1\end{bmatrix} : x, y, z \in \mathbb{R}\right\}$$
is the three dimensional Heisenberg group, and
$$\Gamma_r = \left\{\begin{bmatrix} 1 & a & \frac{c}{r}\\ 0 & 1 & b\\ 0 & 0 & 1\end{bmatrix} : a, b, c \in \mathbb{Z}\right\}$$
is a discrete subgroup. Note that $H(3, \mathbb{R})$ is diffeomorphic to $\mathbb{R}^3$, but they are not isomorphic as Lie groups because $H(3, \mathbb{R})$ is not abelian while $\mathbb{R}^3$ is. For $r = 1$, the subgroup $\Gamma_1$ is precisely the three-dimensional integral Heisenberg group $H(3, \mathbb{Z})$ and the quotient $H(3, \mathbb{R})/H(3, \mathbb{Z})$ is known as the three-dimensional Heisenberg manifold.
For each $r \neq 0$, the quotient $H(3, \mathbb{R})/\Gamma_r$ is orientable as the nowhere-zero three-form $dx\wedge dy\wedge dz$ on $H(3, \mathbb{R})$ is invariant under the action of $\Gamma_r$. Moreover, there is compact fundamental domain for the action of $\Gamma_r$ (see here for the $r = 1$ case), and hence $H(3, \mathbb{R})/\Gamma_r$ is compact. One can show that the map $H(3, \mathbb{R})/\Gamma_r \to \mathbb{R}^2/\mathbb{Z}^2$ given by $A + \Gamma_r \mapsto (x, y) + \mathbb{Z}^2$ is a submersion, so it follows from Ehresmann's theorem that $H(3, \mathbb{R})/\Gamma_r$ is the total space of an orientable circle-bundle over $T^2$.
Note that $\pi_1(H(3, \mathbb{R})/\Gamma_r) \cong \Gamma_r$. As
$$\begin{bmatrix} 1 & a_1 & \frac{c_1}{r}\\ 0 & 1 & b_1\\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix} 1 & a_2 & \frac{c_2}{r}\\ 0 & 1 & b_2\\ 0 & 0 & 1\end{bmatrix} = \begin{bmatrix} 1 & a_1 + a_2 & \frac{c_1}{r} + a_1b_2 + \frac{c_2}{r}\\ 0 & 1 & b_1 + b_2\\ 0 & 0 & 1\end{bmatrix},$$
we see that
$$[\Gamma_r, \Gamma_r] = \left\{\begin{bmatrix} 1 & 0 & c\\ 0 & 1 & 0\\ 0 & 0 & 1\end{bmatrix} : c \in \mathbb{Z}\right\}$$
and hence $[[\Gamma_r, \Gamma_r], \Gamma_r]$ is trivial, i.e. $\Gamma_r$ is two-step nilpotent.
Is $H(3, \mathbb{R})/\Gamma_r \to T^2$ the Chern class $r$ orientable circle bundle (as notation might suggest)? In order to answer this, note that it follows from the Gysin sequence applied to the circle bundle $M_r \to T^2$ that $H_1(M_r; \mathbb{Z}) \cong \mathbb{Z}\oplus\mathbb{Z}\oplus\mathbb{Z}/r\mathbb{Z}$. On the other hand
$$H_1(H(3, \mathbb{R})/\Gamma_r; \mathbb{Z}) \cong \pi_1(H(3, \mathbb{R})/\Gamma_r)^{\text{ab}} \cong \Gamma_r^{\text{ab}} \cong \mathbb{Z}\oplus\mathbb{Z}\oplus\mathbb{Z}/r\mathbb{Z}$$
where the last isomorphism follows from the description of $[\Gamma_r, \Gamma_r]$ above. Therefore, up to a choice of orientation, we see that $H(3, \mathbb{R})/\Gamma_r \to T^2$ is the Chern class $r$ orientable circle-bundle and hence $M_r$ is diffeomorphic to $H(3, \mathbb{R})/\Gamma_r$. Hence $\pi_1(M_r) \cong \pi_1(H(3,\mathbb{R}/\Gamma_r) \cong \Gamma_r$ is two-step nilpotent.
To see that the description of $\pi_1(M_r)$ is consistent with the ones given by Jason DeVito and Lee Mosher, note that there is an isomorphism $\Gamma_r \cong \langle a, b, c \mid [a, c] = [b, c] = 1, [a, b] = c^r\rangle$ given by
$$\begin{bmatrix} 1 & 1 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1\end{bmatrix} \mapsto a,\quad
\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 1\\ 0 & 0 & 1\end{bmatrix} \mapsto b,\quad
\begin{bmatrix} 1 & 0 & \frac{1}{r}\\ 0 & 1 & 0\\ 0 & 0 & 1\end{bmatrix} \mapsto c.$$
It follows from this presentation that
$$\Gamma_r^{\text{ab}} \cong \langle a, b, c \mid [a, b] = [a, c] = [b, c] = c^r = 1\rangle \cong \langle a\rangle\oplus\langle b\rangle\oplus\langle c \mid c^r = 1\rangle \cong \mathbb{Z}\oplus\mathbb{Z}\oplus\mathbb{Z}/r\mathbb{Z}$$
which agrees with the calculation above.
In general, manifolds which arise this way always have nilpotent fundamental group. More precisely, for every $r$, the manifold $M_r$ is of the form $N/\Gamma$ where $N$ is a simply connected nilpotent Lie group and $\Gamma < N$ is a discrete subgroup; that is, $M_r$ is a nilmanifold (every compact nilmanifold can be realised as such a quotient). As $\pi_1(N/\Gamma) \cong \Gamma < N$ and $N$ is nilpotent, it follows that the fundamental group of a compact nilmanifold is always nilpotent. The non-trivial part of this answer was to show that orientable circle bundles over $T^2$ are indeed nilmanifolds.