  This thesis presents several new insights on the interface between
mathematics and theoretical physics, with a central role for fermions on
Riemann surfaces. First of all, the duality between Vafa-Witten theory and WZW
models is embedded into string theory. Secondly, this model is generalized to a
web of dualities connecting topological string theory and N=2 supersymmetric
gauge theories to a configuration of D-branes that intersect over a Riemann
surface. This description yields a new perspective on topological string theory
in terms of a KP integrable system based on a quantum curve. Thirdly, this
thesis describes a geometric analysis of wall-crossing in N=4 string theory.
And lastly, it offers a novel approach to construct metastable vacua in type
IIB string theory.
