$\int_{\alpha}z^2 \log\left(\frac{z+1}{z-1}\right)\,dz$ where $\alpha$ is $|z-1|=1$ Calculate
$$\int_{\alpha}z^2 \log\left(\frac{z+1}{z-1}\right)\,dz$$
where $\alpha$ is $|z-1|=1$ and the initial point of integration $z_1=1+i$.

The function isn't analytic at $1$ and $-1$. Is there a theorem to solve it?
Transformation of the integral $z\to 1/z$
$$f(z)=\frac{\log\left(\frac{1+z}{1-z}\right)}{z^4}$$
How do I transform the circumference $1+e^{i\theta}$?
Is there any other way?
 A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
&\int_{\verts{z - 1} = 1}z^{2}\ln\pars{z + 1 \over z - 1}\,\dd z 
\,\,\,\stackrel{z - 1\ \mapsto\ z}{=}\,\,\,
\int_{\verts{z} = 1}\pars{z + 1}^{2}\ln\pars{1 + {2 \over z}}\,\dd z
\\[5mm] \stackrel{z\ \mapsto\ 1/z}{=}\,\,\,&
\int_{\verts{z} = 1}\pars{{1 \over z} + 1}^{2}\ln\pars{1 + 2z}
\,{\dd z \over z^{2}} =
\int_{\verts{z} = 1}{\pars{1 + z}^{2} \over z^{4}}\ln\pars{1 + 2z}
\,\dd z
\\[3mm] = &\
2\pi\ic\,{1 \over 2!}\ \overbrace{\lim_{z \to 0}\totald[2]{}{z}
{\pars{1 + z}^{2}\ln\pars{2z + 1} \over z}}^{\ds{4 \over 3}}\ -\
\int_{-1}^{-1/2}
{\pars{1 + x}^{2} \over x^{4}}\bracks{\ln\pars{-1 - 2x} + \pi\ic}\,\dd x
\\[3mm] - &\
\int_{-1/2}^{-1}
{\pars{1 + x}^{2} \over x^{4}}\bracks{\ln\pars{-1 - 2x} - \pi\ic}\,\dd x
\\[3mm] = &\
{4 \over 3}\,\pi\ic - 2\pi\ic\
\overbrace{\int_{1/2}^{1}{\pars{1 - x}^{2} \over x^{4}}\,\dd x}^{\ds{1 \over 3}}
=\
\bbox[15px,#ffe,border:1px dotted navy]{\ds{{2 \over 3}\,\pi\ic}}
\end{align}
A: 
The integral 
$$I=\oint_{|z-1|=1}z^2\log\left(\frac{z+1}{z-1}\right)\,dz\tag 1$$
is not uniquely defined unless we prescribe a branch for the complex logarithm.



BRANCH CUT CHOICE $1$:

If we decide to cut the plane from $-1$ to $1$ with a "slit" along the real axis, then we have
$$\log\left(\frac{z+1}{z-1}\right)\,dz=\log\left|\frac{z+1}{z-1}\right|+i\arg\left(\frac{z+1}{z-1}\right)$$
where $-\pi <\arg(z-1)\le \pi$, $-\pi <\arg(z+1)\le \pi$, and for $|z-1|=1$, $-\pi< \arg\left(\frac{z+1}{z-1}\right)\le \pi$.
We can evaluate the integral $I$ a number of ways.  If we choose to use the parametric description $z=1+e^{i\phi}$, $-\pi <\phi\le \pi$, then
$$\begin{align}
I&=\underbrace{\int_{-\pi}^\pi (1+e^{i\phi})^2 \log(2+e^{i\phi})\,ie^{i\phi}\,d\phi}_{=0\,\text{since}\,z^2\log(1+z)\,\text{is analytic}}-\int_{-\pi}^\pi (1+e^{i\phi})^2 \log(e^{i\phi})\,ie^{i\phi}\,d\phi\\\\
&=\int_{-\pi}^\pi \phi (e^{i\phi}+2e^{i2\phi}+e^{i3\phi})\,d\phi\\\\
&=i\int_0^{2\pi} \phi(\sin(\phi)+2\sin(2\phi)+\sin(3\phi))\,d\phi\\\\
&=i2\pi/3
\end{align}$$
Alternatively, we can use Cauchy's integral theorem to evaluate $(1)$.  We deform the contour $|z-1|=1$ around the branch cut and find that 
$$\begin{align}0&=\int_{|z-1|=1}z^2\log\left(\frac{z+1}{z-1}\right)\,dz\\\\
&+\int_0^1 x^2 \left(\log\left(\frac{x+1}{1-x}\right)-i\pi\right)\,dx\\\\
&-\int_0^1 x^2 \left(\log\left(\frac{x+1}{1-x}\right)+i\pi\right)\,dx\\\\
&=\int_{|z-1|=1}z^2\log\left(\frac{z+1}{z-1}\right)\,dz-i2\pi/3
\end{align}$$
whence we find that $I=i2\pi/3$ as expected.


BRANCH CUT CHOICE $2$:

If instead, we decide to cut the plane with the two branch cuts from (i) $-1$ to $-\infty$ and (ii) from $1$ to $\infty$ along the real axis, then we have
$$\log\left(\frac{z+1}{z-1}\right)\,dz=\log\left|\frac{z+1}{z-1}\right|+i\arg\left(\frac{z+1}{z-1}\right)$$
where $-\pi <\arg(z-1)\le \pi$, $0 <\arg(z+1)\le 2\pi$, and for $|z-1|=1$, $0< \arg\left(\frac{z+1}{z-1}\right)\le 2\pi$.
If we choose to use the parametric description $z=1+e^{i\phi}$, $0 <\phi\le 2\pi$, then
$$\begin{align}
I&=\underbrace{\int_0^{2\pi} (1+e^{i\phi})^2 \log(2+e^{i\phi})\,ie^{i\phi}\,d\phi}_{=0\,\text{since}\,z^2\log(1+z)\,\text{is analytic}}-\int_0^{2\pi} (1+e^{i\phi})^2 \log(e^{i\phi})\,ie^{i\phi}\,d\phi\\\\
&=\int_0^{2\pi} \phi (e^{i\phi}+2e^{i2\phi}+e^{i3\phi})\,d\phi\\\\
&=\int_0^{2\pi} \phi(\cos(\phi)+2\cos(2\phi)+\cos(3\phi))\,d\phi+i\int_0^{2\pi} \phi(\sin(\phi)+2\sin(2\phi)+\sin(3\phi))\,d\phi\\\\
&=-i14\pi/3
\end{align}$$
Alternatively, we can use Cauchy's integral theorem to evaluate $(1)$.  We deform the contour $|z-1|=1$ around the branch cut and find that 
$$\begin{align}0&=\int_{|z-1|=1}z^2\log\left(\frac{z+1}{z-1}\right)\,dz\\\\
&+\int_1^2 x^2 \left(\log\left(\frac{x+1}{x-1}\right)\right)\,dx\\\\
&-\int_1^2 x^2 \left(\log\left(\frac{x+1}{x-1}\right)-i2\pi\right)\,dx\\\\
&=\int_{|z-1|=1}z^2\log\left(\frac{z+1}{z-1}\right)\,dz+i14\pi/3
\end{align}$$
whence we find that $I=-i14\pi/3$ as expected.


We have shown that the value of the integral $I$ depends on our choice of branch for the complex logarithm.  The reason for the different values is not surprising given that the logarithm function itself is different on the different Riemann sheets.

A: $g(z)=z^2 (\log(1+z)-i\pi)$ is analytic on $|z-1| < 2$ so that $\int_{|z-1| = 1} g(z)dz = 0$. 
Thus, it reduces to finding a primitive of $$h(z) = -z^2 \log(1-z) = \sum_{n=1}^\infty \frac{z^{n+2}}{n}$$ ie. $$H(z) = \sum_{n=1}^\infty \frac{z^{n+3}}{n(n+3)}=\frac13\sum_{n=1}^\infty z^{n+3} (\frac{1}{n+3}-\frac{1}{n}) \\ =-\frac13 z^3\log(1-z)+ \frac13 (\log(1-z)-z-\frac{z^2}{2})$$ 
Finally, being careful with the branches, and using that $H(1+ze^{2i\pi}) =H(1+z)- \frac{z^3-1}{3}2i\pi$
 $$\int_{|z-1|=1} z^2 \log\left(\frac{z+1}{z-1}\right)\,dz=\int_{|z-1|=1} (g(z)+h(z))dz = \int_{|z-1|=1} h(z)dz  = H(1+1)-H(1+ e^{2i\pi})\\= \frac{7}{3} 2i \pi$$
or something like that
