Using Residue theorem I read Book by Egorychev in Russian. I don't understand the following identity
$$S_m=\frac{1}{2\pi i m}\int_{|w|=\frac12}(2+w)(1+w)^m(1+w+w^2)^{-1}w^{-m-1}dw=-\frac1m \frac{(2+w)(1+w)^m}{(1+2w)w^{m+1}} \ |_{w=-1/2\pm i \frac{\sqrt 3}{2}}$$
I try to use Residue theorem. I find Poles $w=-1/2\pm i \frac{\sqrt 3}{2}$ of the function $f=(2+w)(1+w)^m(1+w+w^2)^{-1}w^{-m-1}.$ I know that 
$$S_m=\frac{1}{2\pi i m}*2\pi i (Res(f,-1/2- i \frac{\sqrt 3}{2})+Res(f,-1/2+ i \frac{\sqrt 3}{2})).$$
I must find Laurent series expansion but I do not understand at what point. I see that $(1+w+w^2)'=1+2w$ But I do not know how to apply
At this point I am now stuck
 A: I use this Egorychev method sometimes to evaluate sums of binomial coefficients without having read his books (discovered it at MSE). Suppose we drop the factor $1/m$ which does not contribute and ask to evaluate
$$\frac{1}{2\pi i}
\int_{|w|=1/2} \frac{(2+w)(1+w)^m}{(1+w+w^2)w^{m+1}} \; dw.$$
Call the function $f(w).$ There is a pole at zero and there are two poles on the unit circle at
$$\rho_{1,2} = -\frac{1}{2} \pm \frac{1}{2} \sqrt{3} i.$$
We could evaluate this contour integral in two ways, either computing the residue at zero or minus the sum of the residues at $\rho_{1,2}$ (the former lies inside the circle and the latter two outside). Suppose we choose the latter. Then we have to take the residue at infinity into account, obtaining
$$-(\mathrm{Res}_{w=\rho_1} f(w) + \mathrm{Res}_{w=\rho_2} f(w) + 
\mathrm{Res}_{w=\infty} f(w)).$$
But we have on a circular contour of radius $R$ with $R$ going to infinity that the integrand is of order $O(R^{m+1}/R^{m+3}) = O(1/R^2)$ so for $m\ge 1$ the residue at infinity is zero.
The poles at $\rho_{1,2}$ are simple and therefore
$$\mathrm{Res}_{w=\rho_{1,2}} \frac{1}{1+w+w^2}= 
\lim_{w\to\rho_{1,2}} \frac{w-\rho_{1,2}}{1+w+w^2}
= \left.\frac{1}{1+2w}\right|_{w=\rho_{1,2}}.$$
Therefore the value of the integral is
$$-\sum_{w=\rho_{1,2}} \frac{(2+w)(1+w)^m}{(1+2w) w^{m+1}}.$$
with the minus sign because we chose the poles outside the contour.
Addendum. We have that
$$\frac{1+\rho_{1,2}}{\rho_{1,2}} = \frac{1}{2} \mp \frac{1}{2}\sqrt{3}i$$
so that these are the roots of $z^2-z+1.$
The sum formula now immediately implies that the sequence fits the recurrence $$a_{m+2} = a_{m+1} - a_m.$$
Since $$-\sum_{w=\rho_{1,2}} \frac{(2+w)(1+w)}{(1+2w) w^{2}} = 1
\quad\text{and}\quad
-\sum_{w=\rho_{1,2}} \frac{(2+w)(1+w)^2}{(1+2w) w^{3}} = -1$$
we get the sequence
$$1, -1, -2, -1, 1, 2, 1, -1,\ldots$$
A: Too long for a comment. We have
$$(2+w)(1+w)^m(1+w+w^2)^{-1}w^{-m-1}=\frac{(2+w)(1+w)^m}{(1+w+w^2)w^{m+1}}$$
Assuming $\;m\in\Bbb N\;$ , this function probably has poles whenever the denominator vanishes, which happens when $\;w=0\;$ or when
$$0=1+w+w^2=\frac{w^3-1}{w-1}\iff w^3=1\;,\;\;\text{since}\;\;w\neq1\;\;\text{for}\;\;|w|=\frac12$$
Yet we also have that $\;w^3\neq1\;$ whenever $\;|w|=\frac12\;$ (why?), so the only pole is zero, which is clearly a pole of order $\;m+1\;$ .
Now, by what you wrote, it looks like there should be a pole or something with some residue at the point $\;z=-\frac12\pm\frac{\sqrt3}2i\;$ , but I can't see why or how...
