  The finite-rank Lieb-Thirring inequality provides an estimate on a Riesz sum
of the $N$ lowest eigenvalues of a Schr\"odinger operator $-\Delta-V(x)$ in
terms of an $L^p(\mathbb{R}^d)$ norm of the potential $V$. We prove here the
existence of an optimizing potential for each $N$, discuss its qualitative
properties and the Euler--Lagrange equation (which is a system of coupled
nonlinear Schr\"odinger equations) and study in detail the behavior of
optimizing sequences. In particular, under the condition
$\gamma>\max\{0,2-d/2\}$ on the Riesz exponent in the inequality, we prove the
compactness of all the optimizing sequences up to translations. We also show
that the optimal Lieb-Thirring constant cannot be stationary in $N$, which
sheds a new light on a conjecture of Lieb-Thirring. In dimension $d=1$ at
$\gamma=3/2$, we show that the optimizers with $N$ negative eigenvalues are
exactly the Korteweg-de Vries $N$--solitons and that optimizing sequences must
approach the corresponding manifold. Our work covers the critical case
$\gamma=0$ in dimension $d\geq3$ (Cwikel-Lieb-Rozenblum inequality) for which
we exhibit and use a link with invariants of the Yamabe problem.
