Evalutation of an integral I am trying to evaluate the integral
$$
\int_{-\infty}^{\infty} \mathrm{d} w \frac{1}{w^n} \left (e^{iwx} -1 \right )^n e^{-iwx}
$$
for some positive integer $n$ without much success. It doesn't diverge at 0 and seems pretty normal, but I can't find a general solution. For $n = 1$, the resulting function should be a constant, and for $n = 2$ a triangle of the form $1-|x-1|$ (with some rescaling).
I would be grateful for any help. Thanks a lot.
EDIT:
The original problem I was trying to solve is a $n$-multiple autocorrelation of a rectangular function $f(x) = 1$ for $0<x<1$, 0 otherwise.
 A: Original Question
Since there the only singularity at $w=0$ is removable, the integrand is entire. 
Suppose $x\gt0$. By Cauchy's Integral Theorem, the integral over the contour $[-R,R]\cup Re^{i\pi[0,1]}$ must be $0$ for all $R$. For $n\ge2$, the integral over the semicircle vanishes as $R\to\infty$, so we must have that
$$
\int_{-\infty}^\infty\left(\frac{e^{iwx}-1}w\right)^n\,\mathrm{d}w=0\tag{1}
$$
For $n=1$, the integral along $Re^{i\pi[0,1]}$ tends to
$$
\int_0^1\frac{-1}{Re^{i\pi t}}Re^{i\pi t}i\pi\,\mathrm{d}t=-i\pi\tag{2}
$$
so the integral along $[-R,R]$ must tend to $i\pi$. Thus,
$$
\int_{-\infty}^\infty\frac{e^{iwx}-1}w\,\mathrm{d}w=i\pi\tag{3}
$$
The even part in $w$ of the integrand in $(3)$ is odd in $x$, so for $x\lt0$, the integral in $(3)$ would be $-i\pi$.
If $x\lt0$, then the same arguments can be made for $n\ge2$ with the contour $[-R,R]\cup Re^{-i\pi[0,1]}$
Obviously, if $x=0$, the integrand is $0$.
Putting this all together, we have
$$
\int_{-\infty}^\infty\left(\frac{e^{iwx}-1}w\right)^n\,\mathrm{d}w
=\left\{\begin{array}{}
0&\text{if }n\ge2\\
i\pi\,\mathrm{sgn(x)}&\text{if }n=1
\end{array}\right.\tag{4}
$$

Modified Question
Since there are no singularities and the integrand tends to $0$ as $|z|\to0$ near $\mathbb{R}$, the difference between the integral along $(-\infty,\infty)$ and the integral along $(-\infty+i,\infty+i)$ is $0$.
We will assume that $x\gt0$. For $x\lt0$, we simply need to take the conjugate.
Use the binomial theorem to expand $(e^{iwx}-1)^n$. When the $n-k-1\ge0$, close the contour with a counter-clockwise semi-circle in the upper half-plane (containing no singularities). When $n-k-1\lt0$, that is when $k=n$, close the contour with a clockwise semi-circle in the lower half-plane (containing the singularity at $z=0$).
For $n\ge2$,
$$
\begin{align}
\int_{-\infty}^\infty\left(\frac{e^{iwx}-1}w\right)^ne^{-iwx}\,\mathrm{d}w
&=\int_{-\infty+i}^{\infty+i}\sum_{k=0}^n(-1)^k\binom{n}{k}e^{iw(n-k-1)x}\frac{\mathrm{d}w}{w^n}\\
&=-2\pi i(-1)^n\operatorname*{Res}_{z=0}\left(\frac{e^{-iwx}}{w^n}\right)\\
&=-2\pi i(-1)^n\frac{(-ix)^{n-1}}{(n-1)!}\\
&=\frac{2\pi(ix)^n}{|x|(n-1)!}
\end{align}
$$
where $i^nx^{n-1}$ is written as $(ix)^n/|x|$ so that when $x$ changes sign, we get the conjugate.
For $n=1$, we get the negative of the integral for $-x$ in the original question. That is,
$$
\int_{-\infty}^\infty\left(\frac{e^{iwx}-1}w\right)^ne^{-iwx}\,\mathrm{d}w
=\left\{\begin{array}{}
\frac{2\pi(ix)^n}{|x|(n-1)!}&\text{if }n\ge2\\
i\pi\,\mathrm{sgn(x)}&\text{if }n=1
\end{array}\right.\tag{4}
$$
Note that the answer for $n=1$ is half the answer gotten by extrapolating the answer for $n\ge2$.
A: With a probabilistic approach, we can exploit the fact that, if $x>0$,
$$\frac{e^{itx}-1}{itx}$$
is the CF of the uniform distribution over the interval $[0,x]$, hence if $X_1,\ldots,X_n$ are independent random variables with such a distribution and $f$ is the pdf of $X_1+\ldots+X_n$, then your integral just depends on $f(0)$.
