It is a classical problem in geometry to find the densest sphere packing in n-dimensional Euclidean space. Analogous problems of packing among lattices, or on compact spaces such as the sphere or Hamming space, are widely studied in number theory, discrete geometry, coding theory and combinatorics. I will talk about some recent work which puts these problems in the framework of potential energy minimization. This leads to experimental and theoretical techniques to approach these optimization problems (and their inverse problems), and leads to some surprising new results in high dimensions.