The two-body potential of systems with long-range interactions decays at large distances as \(V(r)\sim 1/r^\alpha\), with \(\alpha\leq d\), where \(d\) is the space dimension. Examples are: gravitational systems, two-dimensional hydrodynamics, two-dimensional elasticity, charged and dipolar systems. Although such systems can be made extensive, they are intrinsically non additive. Moreover, the space of accessible macroscopic thermodynamic parameters might be non convex. The violation of these two basic properties is at the origin of ensemble inequivalence, which implies that specific heat can be negative in the microcanonical ensemble and temperature jumps can appear at microcanonical first order phase transitions. The lack of convexity implies that ergodicity may be generically broken. We present here a comprehensive review of the recent advances on the statistical mechanics and out-of-equilibrium dynamics of systems with long-range interactions. The core of the review consists in the detailed presentation of the concept of ensemble inequivalence, as exemplified by the exact solution, in the microcanonical and canonical ensembles, of mean-field type models. Relaxation towards thermodynamic equilibrium can be extremely slow and quasi-stationary states may be present. The understanding of such unusual relaxation process is obtained by the introduction of an appropriate kinetic theory based on the Vlasov equation.