  We present exact results on the behavior of the thermodynamic Casimir force
and the excess free energy in the framework of the $d$-dimensional spherical
model with a power law long-range interaction decaying at large distances $r$
as $r^{-d-\sigma}$, where $\sigma<d<2\sigma$ and $0<\sigma\leq2$. For a film
geometry and under periodic boundary conditions we consider the behavior of
these quantities near the bulk critical temperature $T_c$, as well as for
$T>T_c$ and $T<T_c$. The universal finite-size scaling function governing the
behavior of the force in the critical region is derived and its asymptotics are
investigated. While in the critical and under critical region the force is of
the order of $L^{-d}$, for $T>T_c$ it decays as $L^{-d-\sigma}$, where $L$ is
the thickness of the film. We consider both the case of a finite system that
has no phase transition of its own, when $d-1<\sigma$, as well as the case with
$d-1>\sigma$, when one observes a dimensional crossover from $d$ to a $d-1$
dimensional critical behavior. The behavior of the force along the phase
coexistence line for a magnetic field H=0 and $T<T_c$ is also derived. We have
proven analytically that the excess free energy is always negative and
monotonically increasing function of $T$ and $H$. For the Casimir force we have
demonstrated that for any $\sigma \ge 1$ it is everywhere negative, i.e. an
attraction between the surfaces bounding the system is to be observed. At
$T=T_c$ the force is an increasing function of $T$ for $\sigma>1$ and a
decreasing one for $\sigma<1$. For any $d$ and $\sigma$ the minimum of the
force at $T=T_c$ is always achieved at some $H\ne 0$.
