integrate $\int_0^{\frac{\pi}{4}}\frac{dx}{2+\tan x}$ 
$$\int^{\frac{\pi}{4}}_{0}\frac{dx}{2+\tan x}$$

$v=\tan(\frac{x}{2})$
$\tan x=\frac{2v}{1-v^2}$
$dx=\frac{2\,dv}{1+v^2}$
$$\int^{\frac{\pi}{4}}_0 \frac{dx}{2+\tan x}=\int^{\frac{\pi}{8}}_0 \frac{\frac{2\,dv}{1+v^2}}{2+\frac{2v}{1-v^2}}=\int^{\frac{\pi}{8}}_0 \frac{1-v^2}{(1+v^2)(-v^2+v+1)} \, dv$$
Using partial fractions 
$$-\frac{1}{5}\int^{\frac{\pi}{8}}_0 \frac{-2v+4}{v^2+1}+\frac{1}{5}\int^{\frac{\pi}{8}}_0 \frac{-2v+1}{-v^2+v+1}=\frac{1}{5}\int^{\frac{\pi}{8}}_0 \frac{2v}{v^2+1}-\frac{1}{5}\int^{\frac{\pi}{8}}_0 \frac{4}{v^2+1}+\frac{1}{5}\int^{\frac{\pi}{8}}_0 \frac{-2v+1}{-v^2+v+1}$$
$$=\frac{1}{5}ln|v^2+1|-\frac{4}{5}\arctan(v)+\frac{1}{5}ln|-v^2+v+1|$$ from $\frac{\pi}{8}$ to $0$
$0.02-0+0.299-0+0.04-0=0.359$
But it should come out 0.32

You have made a mistake in simplifying the integrand. You should have
$$\int \frac{\frac{2dv}{1+v^2}}{2+\frac{2v}{1-v^2}} = \int \frac{1-v^2}{(1+v^2)(1+v-v^2)}dv.$$
Now do partial practions. You get
$$ \frac{1-v^2}{(1+v^2)(1+v-v^2)} = \frac{2v-1}{5(v^2-v-1)} -\frac{2v-2}{5(v^2+1)} .$$
The first integral is a U-substitution. For the second, split the numerator up, then U-substitution and arctan respectively.
