Contour integral of rational function Here is the problem:
Given the region bounded by $D = \{z \in \mathbb{C} \ | z = Re^{i\theta}, \theta \in (0,\frac{\pi}{7}) \}$ (part of a unit circle from $0$ to $\frac{2\pi}{7}$, and R goes to infinity) evaluate the integral:
$$
I =\int_0 ^{\infty} \frac{x}{1+x^7} dx
$$
What I have come with so far:
All the poles of the function are of the form $x = e^{i(\frac{\pi}{7} + \frac{ 2k\pi}{7})}$ for $k = 0, ..., 6$. It is not hard to see that the only pole in this region is $z = e^\frac{\pi i}{7}$. So now I applied the residum theorem:
$$
Res\Big(\frac{x}{1+x^7}, e^\frac{\pi i}{7}\Big) = \lim_{z \rightarrow e^\frac{\pi i}{7}} (z-e^\frac{\pi i}{7})\frac{z}{1+z^7}.
$$
And here is where I get my first problem, of how to simplify this expression.
Now my other problem is finding the integrals over the border. So for the integral over the circle segment I used parametrization $z = e^{i\theta}$ and got:
$$
 \Big|\int_0 ^\frac{2\pi}{7} \frac{R^2 e^{2i\theta}}{1+R^7e^{7i\theta}} d\theta \Big| \leq \int_0 ^\frac{2\pi}{7} \frac{R^2}{R^7-1} d\theta
$$
And as $R \rightarrow \infty$ integral goes to $0$. However when trying to integrate over the line through $0$ and $e^\frac{\pi}{7}$ with parametrization $z = (R-t) e^\frac{\pi}{7}$ I got:
$$
\int_0 ^R-\frac{(R-t)R^2 e^\frac{4i\pi}{7}}{1+R^7(R-t)^7} dt
$$
And here is where I get stuck, since I do not know how to solve this integral.
EDIT:
I was able to solve the last integral and it goes as:
$$
- R^2 e^\frac{4i\pi}{7} \int_0 ^R\frac{(R-t)}{1+R^7(R-t)^7} dt = - R^2 e^\frac{4i\pi}{7} \int_0 ^R\frac{m}{1+R^7m^7} dt = - e^\frac{4i\pi}{7} \int_0 ^{R^2}\frac{t}{1+t^7} dt,
$$
where in the second integral I used substitution $m=R-t$ and in the second integral I used substitution $Rm = x$.
When I sent $R$ to infinity I get: $e^\frac{4\pi i}{7}I$.
So know it is only the matter of the first problem:
$$
I = \frac{Res(F(x),e^\frac{i\pi}{7})}{1-e^\frac{\pi 4i}{7}}
$$
How to simplify the residu?
 A: For your first problem, note that
$$ 1+z^7 = (z-e^{\pi i/7})(z-e^{3\pi i/7})(z-e^{5\pi i/7})\cdots (z-e^{13\pi i/7}) $$
so when you have
$$ (z-e^{\pi i/7})\frac{z}{1+z^7} $$
you can simply cancel that factor from the denominator, and the other 6 will still be left.
Or even better: Set $\omega=e^{\pi i/7}$ for notational convenience, and change variable to $u=z/\omega$. We then have
$$ (z-\omega)\frac{z}{1+z^7} = \omega(u-1)\frac{\omega u}{1+\omega^7u^7} =
\frac{\omega^2u(u-1)}{1 -u^7} = \frac{-\omega^2u}{\Bigl(\frac{u^7-1}{u-1}\Bigr)} 
= \frac{-\omega^2 u}{u^6+u^5+\cdots+u+1}$$
and you're after the limit of this for $u\to 1$ ...

Afterwards, note that the missing part of the contour from $\omega^2R$ back to $0$, is almost the same as the initial part from $0$ to $R$, except backwards, and $z$ is multiplied by $\omega^2$. Note that this does not change the value of $1+z^7$, so for each infinitesimal contribution to the integral, the integrand is simply multiplied by $\omega^2$, and so is $dz$. Thus,
$$ \underbrace{\int_{\omega^2R}^0 \frac{z}{1+z^7}\,dz}_{\text{abusing notation!}} =
- \omega^4 \int_0^R \frac{t}{1+t^7}\,dt $$
which is a known constant times the outbound part of the integral.
