What is $\oint_{C}z+\cfrac{z}{z+\cfrac{z}{\vdots}}dz?$ It occurred to me to try to integrate continued fractions. This is currently, though, beyond my abilities, for it has been a good several years since I've practised the mathematics involved.
The type of integration, I suppose, might be like that of the study of special functions; loose yet rigorous somehow . . . at least as I was taught it.
The Question:

What, if anything, is $$\oint_{C}z+\cfrac{z}{z+\cfrac{z}{\vdots}}dz,\tag{$I$}$$ where $C$ is a contour oriented counterclockwise around (but not including) the interval $[-4, 0]$ in the complex plane?

Context:
Please see the following question on the nature of the continued fraction.
What's the value of $n+\cfrac{n}{n+\cfrac{n}{n+\cfrac{n}{\vdots}}}$ for $n\in\mathbb{C}$?
For some idea of my experience with special functions, please see the following answer of mine (based on the notes of my special functions lecturer at the time of writing).
https://math.stackexchange.com/a/801705/104041
I'm afraid that's all I have to offer in terms of context.
Please help :)
 A: I am not an expert on continued fractions, so take this with a grain of salt.  But here's my take.  We don't know what the continued fraction is, except that we know it is a function of $z$.  Call it $y(z)$:
$\displaystyle y(z) = z + \frac{z}{z+{\frac{z}{etc.}}}$
But now notice that the denominator in the fraction is also $y(z)$!  And so,
$\displaystyle y(z) = z + \frac{z}{y(z)}$
This gives a quadratic equation for $y(z)$, and you can confirm that it is satisfied by
$\displaystyle  y(z)= \frac{z \pm\sqrt{z^2+4z}}{2}  $
So your integral is equivalent to integrating $y(z)$ over your given contour.  (BTW, how you choose between the plus and minus roots, I don't know.  Maybe it doesn't matter?)
A: Let $f(z)$ be the integrand. By the previous question you linked to, $f(z)$ is equal to $\frac{x+\sqrt{x(x+4)}}{2}$ on the positive real line, and is holomorphic on $\mathbb{C} \backslash [-4,0]$. So for positive real $x$ we can rewrite $f(x)$ as follows:
\begin{align*}
f(x)&=\frac{x+\sqrt{x(x+4)}}{2}\\
&=\frac{1}{2}x+\frac{1}{2}x\sqrt{1+\frac{4}{x}}\\
&=\frac{1}{2}x+\frac{1}{2}x\left(1+\frac{1}{2}\left(\frac{4}{x}\right)-\frac{1}{8}\left(\frac{4}{x}\right)^2+\frac{1}{16}\left(\frac{4}{x}\right)^2+\dots\right)\\
&=\frac{1}{2}x+\frac{1}{2}x\left(1+\frac{2}{x}-\frac{2}{x^2}+\frac{4}{x^3}+\dots\right)\\
&=x+1-\frac{1}{x}+\frac{2}{x^2}+\dots
\end{align*}
using the binomial expansion of $\sqrt{1+x}$ and the fact that $\sqrt{x^2}=x$ when $x$ is positive and real.
This series will converge whenever $-1<4/x<1$: that is, whenever $x>4$ (since we're assuming for the moment $x$ is positive). By comparison, that means that this series converges on the entire complex domain $\{z:|z|>4\}$, and is holomorphic on that domain. So this series is actually equal to the integrand on the entire complex domain $\{z:|z|>4\}$: they are two holomorphic functions on the same domain, which agree on the set $\{x \in \mathbb{R}:x>4\}$ in that domain, and that set has non-isolated points.
In short, this shows that the integrand has the Laurent expansion
$$
f(z)=z+1-\frac{1}{z}+\frac{2}{z^2}+\dots
$$
which converges on the domain $\{z:|z|>4\}$. Since the coefficient of $\frac{1}{z}$ in this expansion is $-1$, we can integrate term-by-term over any curve $C$ in this domain, to obtain $\int_C f(z) \, dz=2\pi i(-1)=-2\pi i$.
