residue calculation for rational function A colleague and I are working on a problem and part of it comes down to evaluating the residue of a rational function. In particular,
$$
\mathrm{Res} \left( z^{kn-1} \left( az^{m}+1 \right)^{-k}; r \right),
$$
where $a$, $k$, $m$ and $n$ are positive integers satisfying $a \geq 2$ and $0<m<n$ and $r$ is any $m$-th root of $-1/a$.
The residue appears to have a nice form, $r^{kn}/m^{k}$ times a polynomial in $m$ and $n$ (of total degree $k-1$, it seems), and we have been able to prove this for $k=1$ and $2$ using series expansions, etc. But this becomes increasingly complicated and messy for larger $k$ and we have not been able to find any general pattern to help us along the way.
So our question is whether readers have seen residue problems for such rational functions or know of techniques that could help us to prove the value of this residue for any positive integer $k$.
 A: We want to calculate
$$\rho(k,n,m)=\operatorname*{res}_{w=1}\left(\frac{w^n}{1-w^m}\right)^k\frac{dw}{w}. $$
If $kn$ is divisible by $m$ then it seems that $\rho(k,n,m)=-\binom{-k}{kn/m-k}/m$.  This is because in this case the residues at all $m$'th roots of unity are the same, and the sum of those residues is minus the residue at $\infty$, which is easily calculated by the substitution $w=t^{-1}$ and the binomial expansion of $(1-t^m)^{-k}$.  I have checked this in Maple for a range of cases.  I don't know if this method can be adapted to the case where $kn$ is not divisible by $m$.
One can also check experimentally that the denominator and numerator of $\rho(k,n,m)$ are large, but their factorisation only involves fairly small primes $p$, certainly with $p<knm$.  This typically indicates that the function can be expressed in terms of binomial coefficients and factorials, rather than general polynomials.
A: For $m=1$, this is the residue:
$$\operatorname{Res} \left( z^{kn-1} \left( az+1 \right)^{-k}; -1/a \right)=\frac{(-1)^{k n-k}  }{a^{kn}(k-1)!}\prod _{p=1}^{k-1} (k n-p).$$
A: Let $l=kn-1$. Then we want to find
$$R:=\operatorname{Res} \left(\frac{z^l}{ (1-(z/r)^m)^{k}};r\right)=\operatorname{Res}\left(\frac{(z+r)^l}{\bigl(1-(1+z/r)^m\bigr)^k};0\right).$$
This is the coefficient of $z^{-1}$ in the Laurent series expansion of
$$\frac{(z+r)^l}{\bigl(1-(1+z/r)^m\bigr)^k}.$$
If we replace $z$ with $rz$, we divide the coefficient of $z^{-1}$ by $r$, so
$$R=(-1)^k r^{l+1}[z^{-1}]\left(\frac{(1+z)^l}{\bigl((1+z)^m-1\bigr)^k}\right), $$
where $[z^i]$ extracts the coefficient of $z^i$.
We have
$$
\frac{1}{\bigl((1+z)^m-1\bigr)^k}=(mz)^{-k}\left(\frac{mz}{(1+z)^m-1}\right)^k,
$$
and since $(1+z)^m -1 = mz\bigl(1+\frac{1}{2}(m-1)z+\frac{1}{6}(m-1)(m-2)z^2+\cdots\bigr)$,
we have
$$\left(\frac{mz}{(1+z)^m-1}\right)^k=\sum_{i=0}^\infty P_i(m) z^i,$$ where $P_i(m)$ is a polynomial of degree $i$.
Thus
$$
\begin{aligned}
R&=(-1)^k r^{l+1}m^{-k}[z^{k-1}] (1+z)^l \sum_{i=0}^\infty P_i(m) z^i\\
  &=(-1)^k r^{l+1}m^{-k} \sum_{j=0}^{k-1} \binom{l}{j} P_{k-1-j}(m)\\
  &=(-1)^k r^{kn}m^{-k} \sum_{j=0}^{k-1} \binom{kn-1}{j} P_{k-1-j}(m).
\end{aligned}
$$
The polynomials $P_i(m)$ are essentially "higher-order degenerate Bernoulli numbers".
