I understand how to use the residue method to compute an inverse z-transform of an elementary function easily enough. I'm confused however, because, from reading on Wikipedia, it seems this method is based on the residue theorem from complex analysis (which I don't fully understand), which itself is based on Cauchy's integral theorem (which seems to be a generalization of the gradient theorem from vector calculus).
All of these theorems deal with integrals of continuous functions though. The z-transform is discrete though -- $Z(x(n)) = \sum_{n=0}^\infty x(n)z^{-n}$, where $x(n)$ is discrete.
How does it make sense to apply those theorems about complex line integrals to a discrete sum?