  We study systems of $n$ points in the Euclidean space of dimension $d \ge 1$
interacting via a Riesz kernel $|x|^{-s}$ and confined by an external
potential, in the regime where $d-2\le s<d$. We also treat the case of
logarithmic interactions in dimensions $1$ and $2$. Our study includes and
retrieves all cases previously studied in \cite{ss2d,ss1d,rs}. Our approach is
based on the Caffarelli-Silvestre extension formula which allows to view the
Riesz kernel as the kernel of a (inhomogeneous) local operator in the extended
space $\mathbb{R}^{d+1}$.
  As $n \to \infty$, we exhibit a next to leading order term in $n^{1+s/d}$ in
the asymptotic expansion of the total energy of the system, where the constant
term in factor of $n^{1+s/d}$ depends on the microscopic arrangement of the
points and is expressed in terms of a "renormalized energy." This new object is
expected to penalize the disorder of an infinite set of points in whole space,
and to be minimized by Bravais lattice (or crystalline) configurations. We give
applications to the statistical mechanics in the case where temperature is
added to the system, and identify an expected "crystallization regime." We also
obtain a result of separation of the points for minimizers of the energy.
