Is it possible to evaluate $ \int_0^1 x^n \, dx$ by contour integration? It's been quite a time since I had the complex analysis course. The thing is now I don't know the answer to the following simple question:
Is it possible to find
$$ \int_0^1 x^n \, dx$$
using the methods of contour integration? I've refreshed my knowledge with wikipedia, but I've no idea how to make integrals with no obvious singularities. Though there is a singularity at $\infty$, but how to connect it with $[0,1]$?
 A: Let's consider the contour from $0$ to $1$ ($z=x$) followed by a rotation of angle $\angle \frac{2\pi}n$ ($z=e^{i\phi}$) and then back to $0$ ($z= e^{i\frac {2\pi}n} x$) :
$$\int_0^1 x^n\,dx+\int_0^{\frac {2\pi}n} e^{ni\phi}ie^{i\phi}\,d\phi +\int_1^0 \left(e^{i\frac {2\pi}n}x\right)^n e^{i\frac {2\pi}n}\,dx=0$$
(the integral is $0$ of course for $n\ne -1$)  
since $\displaystyle \int_0^{\frac {2\pi}n} e^{ni\phi}ie^{i\phi}\,d\phi=\left[\frac{e^{(n+1)i\phi}}{n+1}\right]^{\frac {2\pi}n}_{\phi=0}$ we get : 
$$\left(1-e^{i\frac {2\pi}n}\right)\int_0^1 x^n\,dx=\frac {1-e^{i\frac {2\pi}n}}{n+1}$$ 
so that for $n\ne 1$ and $n\ne -1$ at least : $\ \displaystyle \int_0^1 x^n\,dx=\frac 1{n+1}$
For $n=1$ we may choose another maximal angle (for example $\pi$ or $\frac {\pi}2$).
Looking back at this there is some feeling of cheating since we replaced a power integral over $x^n$ by the nearly equivalent integral $\int e^{(n+1)i\phi}\,d\phi$ (at least the increment of $n$ was done!).
A: This is rather a teaser than a proper answer. Well formally it is an answer since it employs contour integration, but not quite in a way I was hoping to see it.
While I was asking about $x^n$, actually I was heading for polynomials in general. So let's pick $P(x)$ to be a polynomial and consider
$$ \int_a^b P(x) \, dx$$
Following @Marvis 's idea antiderivative of $P$ is computed as
$$ \int P(x) \, dx = - \int_{C_r} x P\left( \frac{x}{z} \right) \frac{\log{(1-z)}}{z^2} \, dz $$
Then it's just a fundamental theorem of calculus to find the initial integral. Note, that $x$ above is just a parameter, not the real part of $z$.
