The sum of the absolute values of the eigenvalues of a graph is called the energy of the graph. We study the problem of finding graphs with extremal energy within specified classes of graphs. We develop tools for treating such problems and obtain some partial results. Using calculus, we show that an extremal graph ``should'' have a small number of distinct eigenvalues. However, we also present data that show in many cases that extremal graphs can have a large number of distinct eigenvalues.