  We study three-dimensional ${\mathcal N}=2$ supersymmetric gauge theories on
${\Sigma_g \times S^1}$ with a topological twist along $\Sigma_g$, a genus-$g$
Riemann surface. The twisted supersymmetric index at genus $g$ and the
correlation functions of half-BPS loop operators on $S^1$ can be computed
exactly by supersymmetric localization. For $g=1$, this gives a simple UV
computation of the 3d Witten index. Twisted indices provide us with a clean
derivation of the quantum algebra of supersymmetric Wilson loops, for any
Yang-Mills-Chern-Simons-matter theory, in terms of the associated Bethe
equations for the theory on ${\mathbb R}^2 \times S^1$. This also provides a
powerful and simple tool to study 3d ${\mathcal N}=2$ Seiberg dualities.
Finally, we study A- and B-twisted indices for ${\mathcal N}=4$ supersymmetric
gauge theories, which turns out to be very useful for quantitative studies of
three-dimensional mirror symmetry. We also briefly comment on a relation
between the $S^2 \times S^1$ twisted indices and the Hilbert series of
${\mathcal N}=4$ moduli spaces.
