Is The Value of This Definite Integral $0$? 
Q. Evaluate -$$\int\limits_0^\pi  {{{x\,dx} \over {{a^2}{{\cos }^2}x + {b^2}{{\sin }^2}x}}} $$

My Try - 
$$\eqalign{
  & Let\,I\, = \,\int\limits_0^\pi  {\frac{{x\,dx}}{{{a^2}{{\cos }^2}x + {b^2}{{\sin }^2}x}}}   \cr 
  & \,\,\,\,\,\,\,\,\,\,\, = \int\limits_0^\pi  {\frac{{\left( {\pi  - x} \right)\,dx}}{{{a^2}{{\cos }^2}\left( {\pi  - x} \right) + {b^2}{{\sin }^2}\left( {\pi  - x} \right)}}}   \cr 
  & \,\,\,\,\,\,\,\,\,\,\, = \pi \int\limits_0^\pi  {\frac{{dx}}{{{a^2}{{\cos }^2}x + {b^2}{{\sin }^2}x}}} \,\, - \,\,I  \cr 
  & \,\,\,\,\,\,\,I = \frac{\pi }{2}\int\limits_0^\pi  {\frac{{dx}}{{{a^2}{{\cos }^2}x + {b^2}{{\sin }^2}x}}}   \cr 
  & {\text{Now}}\,{\text{divide}}\,{\text{numerator}}\,{\text{and}}\,{\text{denominator}}\,{\text{by}}\,\,{{\text{b}}^{\text{2}}}{\text{co}}{{\text{s}}^{\text{2}}}{\text{x,}}\,\,\,\, \to \,\,\boxed1  \cr 
  & \,\,\,\,\,\,\,\,\,\, = \frac{\pi }{{2{b^2}}}\int\limits_0^\pi  {\frac{{{{\sec }^2}x\,\,dx}}{{\frac{{{a^2}}}{{{b^2}}} + {{\tan }^2}x}}}   \cr 
  & Let\,\,t = \tan x,\,\,dt = {\sec ^2}x\,dx\,\,and\,  \cr 
  & \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,when\,\,x = 0,\,\,t = 0  \cr 
  & \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,and\,\,x = \pi ,\,\,t = 0  \cr 
  & \,\,\,\,\,\,\,I = \frac{\pi }{{2{b^2}}}\int\limits_0^0 {\frac{{dt}}{{\frac{{{a^2}}}{{{b^2}}} + {t^2}}}}  = 0 \cr} $$

First Question - $$\eqalign{
  & {\text{Infact,}}\,\,{\text{the}}\,{\text{answer}}\,{\text{is}}\,{\text{not}}\,{\text{0}}\,{\text{and}}\,{\text{is}}\,{\text{obtained}}\,{\text{by}}\,{\text{splitting}}\,{\text{the}}\,{\text{integral}}\,{\text{further}}\,{\text{in}}\,step\,\boxed1{\text{.}}\,  \cr 
  & {\text{What}}\,{\text{mistake}}\,{\text{have}}\,{\text{I}}\,{\text{committed}}\,{\text{here?}} \cr} $$

$$\eqalign{
  & {\text{Instead,}}\,{\text{in}}\,step\,\boxed1\,{\text{,}}\,\,{\text{if}}\,{\text{we}}\,{\text{divide}}\,{\text{by}}\,{{\text{a}}^{\text{2}}}{\text{si}}{{\text{n}}^{\text{2}}}{\text{x}}\,{\text{and}}\,{\text{perform}}\,{\text{similar}}\,{\text{substitution,}}  \cr 
  &  = \frac{\pi }{{2{a^2}}}\int\limits_0^\pi  {\frac{{\cos e{c^2}x\,\,dx}}{{\frac{{{b^2}}}{{{a^2}}} + {{\cot }^2}x}}}   \cr 
  & Let\,\,t = \cot x,\,\,dt = \cos e{c^2}x\,dx\,\,and\,  \cr 
  & \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,when\,\,x = 0,\,\,t = not\,defined  \cr 
  & \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,and\,\,x = \pi ,\,\,t = not\,defined \cr} $$

Second Question -$${\text{So,}}\,{\text{why}}\,{\text{can't}}\,{\text{we}}\,{\text{say}}\,{\text{the}}\,{\text{value}}\,{\text{of}}\,{\text{the}}\,{\text{integral}}\,{\text{is}}\,{\text{not}}\,{\text{defined?}}$$


As @José Carlos Santos points out, using a substitution of $t = \tan x$ on the interval $[0,\pi]$ introduces a discontinuity at the point $x = \pi/2$. 
One way this can be avoided, as you correctly identified, is by first changing the interval of integration. If we note that the integrand in the integral
$$I = \int^\pi_0 \frac{dx}{a^2 \cos^2 x + b^2 \sin^2 x},$$
is both an even and periodic function with a fundamental period of $\pi$, since for any continuous and bounded function $f$ with period $\mathfrak{a}$
$$\int^{b + \mathfrak{a}}_b f(x) \, dx = \int^\mathfrak{a}_0 f(x) \, dx,$$
where $b \in \mathbb{R}$, we have
\begin{align*}
I &= \frac{\pi}{2} \int^\pi_0 \frac{dx}{a^2 \cos^2 x + b^2 \sin^2 x}\\
&= \frac{\pi}{2} \int^{-\pi/2 + \pi}_{-\pi/2} \frac{dx}{a^2 \cos^2 x + b^2 \sin^2 x} \qquad \text{(since it is periodic with period $\pi$)}\\
&= \frac{\pi}{2} \int^{\pi/2}_{-\pi/2} \frac{dx}{a^2 \cos^2 x + b^2 \sin^2 x}\\
&= \pi \int^{\pi/2}_0 \frac{dx}{a^2 \cos^2 x + b^2 \sin^2 x} \qquad \text{(since it is even)}.
\end{align*}
Now your substitution of $t = \tan x$ can be made. 
