Finite-size effects in molecular simulations: a physico-mathematical view