This book is devoted to the proof of a deep theorem in arithmetic geometry, the Fekete-Szego theorem with local rationality conditions. The prototype for the theorem is Raphael Robinson's theorem on totally real algebraic integers in an interval, which says that if $[a,b]$ is a real interval of length greater than 4, then it contains infinitely many Galois orbits of algebraic integers, while if its length is less than 4, it contains only finitely many. The theorem shows this phenomenon holds on algebraic curves of arbitrary genus over global fields of any characteristic, and is valid for a broad class of sets. The book is a sequel to the author's work Capacity Theory on Algebraic Curves and contains applications to algebraic integers and units, the Mandelbrot set, elliptic curves, Fermat curves, and modular curves. A long chapter is devoted to examples, including methods for computing capacities. Another chapter contains extensions of the theorem, including variants on Berkovich curves. The proof uses both algebraic and analytic methods, and draws on arithmetic and algebraic geometry, potential theory, and approximation theory. It introduces new ideas and tools which may be useful in other settings, including the local action of the Jacobian on a curve, the universal function'' of given degree on a curve, the theory of inner capacities and Green's functions, and the construction of near-extremal approximating functions by means of the canonical distance.