When to use the property $\int_{0}^{2a}f(x)dx=\int_{0}^{a}f(x)dx+\int_{0}^{a}f(2a-x)dx$? Consider the property: $\displaystyle\int_{0}^{2a}f(x)dx=\int_{0}^{a}f(x)dx+\int_{0}^{a}f(2a-x)dx$
In some definite integral problems this property is used while in others it is not used even though it is usable. In some problems, if we do not use this property we get infinity after substituting the limits whereas in some cases if we use this property we get infinity or the wrong answer.

For example let $I=\displaystyle\int_{0}^{\pi}\frac{x}{a^2\cos^2x+b^2\sin^2x}dx$ 
$=\displaystyle\int_{0}^{\pi}\frac{\pi-x}{a^2\cos^2x+b^2\sin^2x}dx$ 
$\displaystyle 2I= \int_{0}^{\pi}\frac{\pi}{a^2\cos^2x+b^2\sin^2x}dx$
$\displaystyle 2I= \pi\int_{0}^{\pi}\frac{1}{a^2\cos^2x+b^2\sin^2x}dx$
$\displaystyle 2I= \pi\int_{0}^{\pi}\frac{\sec^2x}{a^2+b^2\tan^2x}dx$

Case 1: The property is not used
Let $z=\tan x$
$\therefore (\sec^2x)dx=dz $
When $x=0, z=0$ and when $x=\pi, z=0$
$\displaystyle \therefore 2I= \pi\int_{0}^{0}\frac{dz}{a^2+b^2z^2}$ 
$\therefore I=0$

Case 2:The property is used
$\displaystyle 2I= 2\pi\int_{0}^{\pi/2}\frac{\sec^2x}{a^2+b^2\tan^2x}dx$ 
Let $z=\tan x$
$\therefore (\sec^2x)dx=dz $
When $x=0, z=0$ and when $x=\pi/2, z=\infty$
$\displaystyle \therefore 2I= 2\pi\int_{0}^{\infty}\frac{dz}{a^2+b^2z^2}$ 
This on evaluation yields $\pi^2/2ab$.

This is very confusing. How do i know when to use this property and when to not?
 A: Shift it over by $a$, so that it's $\int_{-a}^a$ versus $\int_0^a$ and $\int_{-a}^0$. When is it worthwhile to split the integral like that? When there's some sort of even/odd symmetry to exploit. Back in the original form, that's symmetry around $a$.
Now, if you're getting results that are different? That means you're making mistakes in at least one of the calculations. Now that you've edited, I can see what it is - you're making a substitution that has a singularity in the middle, and blindly crossing it. That $\int_0^0$? It's really $\int_0^{\infty} +\int_{-\infty}^0$, as $\tan$ goes to $\infty$ in the middle of the interval, then comes back from $-\infty$. See also this AoPS post of mine for a detailed explanation of a similar integral.
A: The formula is useful when you have either $f(2a-x)=f(x)$ or $f(2a-x)=-f(x)$. Mostly trigonometric functions have this property if $a=\pi/2$ and the formula is really useful in such contexts.
The issue in case 1 is not related to this formula but rather is due to the fact that an invalid substitution has been used. Always check the theorem for substitution in definite integrals:

Theorem: Let the function $g$ have a continuous derivative on $[c, d] $ and function $f$ be continuous on $g([c, d]) $. Then we have $$\int_{g(c)} ^{g(d)} f(x) \, dx=\int_{c} ^{d} f(g(t)) g'(t) \, dt$$

In your case $[c, d] =[0, \pi] $ and $g(x) =\tan x$ and you can see that $g$ alone is discontinuous on $[0,\pi]$ so that the requirements of the above theorem are not met. 
