The expansion of the Casimir energy for a scalar field with mass m, in a space where one dimension has been compactified into a circle of length a, leads to a double-infinite series that can be regularized by analytic continuation in the space dimension. The dimensionally regularized sum is then expressed as a power series in am by means of zeta-function expansions. The two possibilities of odd and even space dimensions are distinguished. In the odd space dimension we give a power expansion for small am, in addition to the asymptotic behavior. For the even space dimension, an expansion valid for any value of am is obtained. The contribution of higher-order terms is studied and, for the three-dimensional space, results for different values of the compactification length are shown.