show that $\int_{0}^{\pi/2}\tan^ax \, dx=\frac {\pi}{2\cos(\frac{\pi a}{2})}$ show that $$\int_{0}^{\pi/2}\tan^ax \, dx=\frac {\pi}{2\cos(\frac{\pi a}{2})}$$
I think we can solve it by contour integration but I dont know how. 
If someone can solve it by two way using complex and real analysis its better for me. 
thanks for all.
 A: You can use the beta function 

$$ \beta(x,y) = 2\int_0^{\pi/2}(\sin\theta)^{2x-1}(\cos\theta)^{2y-1}\,d\theta=\frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}, \qquad \mathrm{Re}(x)>0,\ \mathrm{Re}(y)>0 \! $$

to evaluate the integral. In your case 
$$ 2x-1=a \implies x=\frac{a+1}{2}\quad 2y-1=-a \implies y=\frac{1-a}{2}. $$
A: Let $u=\tan{x}$, $dx=du/(1+u^2)$.  Then the integral is
$$\int_0^{\infty} du \frac{u^a}{1+u^2}$$
This integral may be performed for $a \in (-1,1)$ by residue theory.  By considering a contour integral about a keyhole contour about the positive real axis

we find that
$$\left ( 1-e^{i 2 \pi a} \right) \int_0^{\infty} du \frac{u^a}{1+u^2} = i 2 \pi \frac{e^{i \pi a/2}-e^{i 3 a\pi/2}}{2 i}$$
Or
$$\int_0^{\infty} du \frac{u^a}{1+u^2}  = \pi \frac{\sin{\pi a/2}}{\sin{\pi a}} $$
From which the sought after result may be found.
ADDENDUM
A little further explanation.  Consider the contour integral
$$\oint_C dz \frac{z^a}{1+z^2}$$
where $C$ is the above keyhole contour.  This means that the integral may be written as
$$\int_{\epsilon}^R dx \frac{x^a}{1+x^2} + i R \int_0^{2 \pi} d\theta \,e^{i \theta} \frac{R^a e^{i a \theta}}{1+R^2 e^{i 2 \theta}} + \\ e^{i 2 \pi a} \int_R^{\epsilon}dx \frac{x^a}{1+x^2} + i \epsilon \int_0^{2 \pi} d\phi\,e^{i \phi} \frac{\epsilon ^a e^{i a \phi}}{1+\epsilon ^2 e^{i 2 \phi}} $$
We take the limit as $R \to \infty$ and $\epsilon \to 0$ and we recover the expression for the contour integral above.
A: Sorry for being late
$$
\begin{aligned}
\int_0^{\frac{\pi}{2}} \tan ^a x d x&=\int_0^{\frac{\pi}{2}} \sin ^a x \cos ^{-a} x d x \\
& =\int_0^{\frac{\pi}{2}} \sin ^{2\left(\frac{a+1}{2}\right)-1} x \cos ^{2\left(\frac{-a+1}{2}\right)-1} x d x \\
& =\frac{1}{2} B\left(\frac{a+1}{2}, \frac{-a+1}{2}\right) \\
& =\frac{1}{2} \pi \csc \frac{(a+1) \pi}{2} \\
&
\end{aligned}
$$
Applying the Euler-reflection property
$$
B(x, 1-x)=\pi \csc (\pi x) \quad x \notin \mathbb{Z},
$$
we have
$$\boxed{\int_0^{\frac{\pi}{2}} \tan ^a x d x =\frac{\pi}{2 \cos \left(\frac{\pi a}{2}\right)}} $$
