We study intermediate sums, interpolating between integrals and discrete sums, which were introduced by A. Barvinok [Computing the Ehrhart quasi-polynomial of a rational simplex, Math. Comp. 75 (2006), 1449--1466]. For a given semi-rational polytope P and a rational subspace L, we integrate a given polynomial function h over all lattice slices of the polytope P parallel to the subspace L and sum up the integrals. We first develop an algorithmic theory of parametric intermediate generating functions. Then we study the Ehrhart theory of these intermediate sums, that is, the dependence of the result as a function of a dilation of the polytope. We provide an algorithm to compute the resulting Ehrhart quasi-polynomials in the form of explicit step polynomials. These formulas are naturally valid for real (not just integer) dilations and thus provide a direct approach to real Ehrhart theory.