$U(1)$-connection Let $M$ be a smooth manifold. I would like to understand why the moduli space of flat $U(1)$-connections modulo gauge equivalence is the torus
$$
H^1(M;\mathbb{R})/H^1(M;\mathbb{Z}).
$$
How should I see this? 
 A: I'm not sure about arbitrary manifolds, but there is an easy answer for compact Riemann surfaces.
Let $\Sigma\times G\to \Sigma$ be the trivial $G$-bundle over a compact Riemann surface $\Sigma$.  There is a bijective correspondence between gauge equivalence classes of flat connections and representations of the fundamental group (in the gauge group) $\mathrm{Hom}(\pi_{1}(\Sigma),G)$, modulo conjugation by $G$.  
When $G = U(1)$ you don't have much choice for a representation.  The Seifert-Van Kampen theorem gives the following presentation of $\pi_{1}(\Sigma) = \langle \alpha_{1},\beta_{1},\dots,\alpha_{g},\beta_{g} \,\vert\, \prod_{i} [\alpha_{i},\beta_{i}] = 1 \rangle$.  How can you describe a representation $\rho: \pi_{1}(\Sigma) \to G$? Just pick a target for each of the generators while ensuring that the relations are still satisfied.  In this case, $U(1)$ is abelian so there is nothing to be done.  A representation is just a selection of $2g$ points in a circle - i.e. we have that:
$\mathcal{A}_{fl} / \mathcal{G} = U(1)^{2g} = H^{1}(M;\mathbb{R})/H^{1}(M;\mathbb{Z})$
