<s>[INST] How to calculate the residue of this function quickly (or by mathematica)? While looking at this post (The second answer), I find that it is to tedious to calculate the  Residue of
$$ f(z)=-\left(\frac{z-1}{z+1}\right)^2\frac{2n/z}{z^{2n}-1} $$
at $-1$.
I do know that we can do this:
$$\operatorname*{Res}_{z=-1}f(z)=\frac{1}{2!}\frac{d^2}{dz^2}(f(z)\cdot(z+1)^3).$$
But I am not satisfied with this method. I have the following questions:
1. How many methods do we have to calculate this, can you provide me with an ingenious one?
2. I tried to calculate this via Mathematica like this:[]
If I let $n$ take concrete integers, say, $n=5$, we do get the right answer $-34$. However, it seems that we cann't get the right answer if we let $n$ be a variable.  What's wrong here, how can we use mathematica to get a general answer (instead of concrete examples by letting n be some integers). I faced with this sort of problems in similar situations. Can you tell me what shoud I do, or just let me know that mathematica cannot do this! Thank you !
Addition As for Sangchul Lee's answer for my second question, I have another quesion. Why does the following code does not work, what's the difference between "Element[n, Integers]" and "Assumptions -> n \in Integers":
 [/INST] 1. Note that we have
\begin{align*}
-\left(\frac{z-1}{z+1}\right)^2\frac{1}{z(z^2-1)}
&= -\frac{z-1}{(z+1)^3 z} \\
&= -\frac{2}{(z+1)^3} - \frac{1}{(z+1)^2} - \frac{1}{z+1} + \frac{1}{z}.
\end{align*}
Also, if we write $g(z) = \frac{z^{2n}-1}{z^2-1} = 1 + z^2 + z^4 + \cdots + z^{2(n-1)}$, then the Taylor series for $\frac{1}{g(z)}$ about $z = -1$ begins with
\begin{align*}
\frac{1}{g(z)}
&= \frac{1}{g(-1)} - \frac{g'(-1)}{g(-1)^2}(z+1) + \left(\frac{2g'(-1)^2}{g(-1)^3} - \frac{g''(-1)}{g(-1)^2} \right)\frac{(z+1)^2}{2} + \cdots \\
&= \frac{1}{n} + \frac{n-1}{n} (z+1) + \frac{(n-1)(2n-1)}{6n}(z+1)^2 + \cdots.
\end{align*}
Altogether, the residue of $f(z)$ at $z=-1$ can be computed by reading out the coefficient of $(z+1)^{-1}$ in the Laurent expansion of
$$ f(z) = -\left(\frac{z-1}{z+1}\right)^2\frac{1}{z(z^2-1)} \cdot \frac{2n}{g(z)}, $$
about $z=-1$, which is
\begin{align*}
\mathop{\underset{z=-1}{\mathrm{Res}}}f(z)
&= (2n) \biggl[ (-2)\left(\frac{(n-1)(2n-1)}{6n}\right) + (-1)\left(\frac{n-1}{n}\right) + (-1)\left(\frac{1}{n}\right) \biggr] \\
&= -\frac{2}{3}(2n^2+1).
\end{align*}
2. To compute this residue using Mathematica, you may do as follow:

</s>