I believe you're using the wrong residue for the pole at $\displaystyle e^{-i\theta}$ based on the branch you're using: You define:

$\displaystyle z^{-p}=e^{-p\log(z)}=e^{-p(\ln(r)+i\arg(z))},\quad 0\leq \arg(z)\leq 2\pi$

Then for $\displaystyle z=e^{-i\theta}$

$\displaystyle \arg(z)=2\pi-\theta$

Also, try it first for $\displaystyle p=1/4$ and $\displaystyle \theta=\pi/4$ or something easy like this. Do it numerically first in Mathematica, then do it numerically via the Residue Theorem:

Code:

In[56]:=
p = 1/4;
t = Pi/4;
NIntegrate[1/(x^p*(1 - 2*x*Cos[t] +
x^2)), {x, 0, Infinity}]
r1 = Exp[-7*Pi*(I/16)]/
(Exp[(-Pi)*(I/4)] - Exp[Pi*(I/4)]);
r2 = Exp[(-Pi)*(I/16)]/(Exp[Pi*(I/4)] -
Exp[(-Pi)*(I/4)]);
N[((2*Pi*I)/(1 - Exp[-2*Pi*I*p]))*
(r1 + r2)]
Out[58]=
3.4907507252185646
Out[61]=
3.4907507252151033 +
3.487868498008632*^-16*I