Evaluating definite integral - Let's say we want to evaluate $$ \int_0^{2\pi} \frac{1}{a^2\cos^2x+b^2\sin^2x}dx$$
With substitution, one obtains $$ \frac{1}{ab} \arctan\left(\frac ba \tan x\right) $$
as antiderivate. For more details on how to do this, see this question.
Now my question is, why do I receive $0$ if I insert $0$ and $2\pi$ as integration bounds ? This obviously can't be true since the integrand is always positive. 
What do I oversee ? 

A substitution in a integral is allowed as soon as the substitution is given by a bijective and differentiable function. In our case, if the integration range is $(0,2\pi)$ we cannot simply replace $x$ by $\arctan t$ and $dx$ by $\frac{dt}{1+t^2}$, but we have to split the integration range, then apply such substitution on the integrals we get that way:
$$ \int_{0}^{2\pi}\frac{dx}{a^2\cos^2(x)+b^2\sin^2(x)}\\=2\int_{0}^{\pi/2}\frac{dx}{a^2\cos^2(x)+b^2\sin^2(x)}+2\int_{0}^{\pi/2}\frac{dx}{a^2\sin^2(x)+b^2\cos^2(x)}\\=2\int_{0}^{+\infty}\left(\frac{1}{a^2 t^2+b^2}+\frac{1}{a^2+b^2 t^2}\right)\,dt=\color{red}{\frac{2\pi}{ab}}. $$
