Why is $\int^\infty_{-\infty} \frac{x}{x^2+1} dx$ not zero?
Solution 1:
If you "interpret" the integral $ \displaystyle \int_{-\infty}^{\infty} \frac{x}{x^2 + 1} dx$ as $\displaystyle \lim_{R \rightarrow \infty} \int_{-R}^{R} \frac{x}{x^2 + 1} dx$, then it is indeed zero. (This is called the Cauchy principal value).
However, note that the integral $ \displaystyle \int_{-\infty}^{\infty} \frac{x}{x^2 + 1} dx$ can also be interpreted as, for instance, $$\displaystyle \lim_{R \rightarrow \infty} \int_{-R}^{kR} \frac{x}{x^2 + 1} dx = \lim_{R \rightarrow \infty} \frac12 \log \left( \frac{1 + k^2R^2}{1 + R^2} \right) = \log(k) \text{ where }k > 0.$$ You could also take other functions of $R$ such that the lower limit tends to negative infinity and upper limit tends to infinity as $R \rightarrow \infty$ to get different answers.
Hence, $ \displaystyle \int_{-\infty}^{\infty} \frac{x}{x^2 + 1} dx$ is not zero and in fact cannot be assigned any value unless you know how the lower limit and upper limit approach $\infty$.
Solution 2:
We should agree that, whatever it is we want $$\int_{-\infty}^{\infty}f(x)\,dx$$ to be, the expression should still respect the usual rules of integration. In particular, for any real number $c$, we "should" have $$\int_{-\infty}^{\infty}f(x)\,dx = \int_{-\infty}^cf(x)\,dx + \int_c^{\infty}f(x)\,dx.$$
Otherwise, the value of the integral may depend on how we choose to evaluate the integral, and that is no good.
This in turn means that in order for $$\int_{-\infty}^{\infty}f(x)\,dx$$ to make sense, we need both $$\int_{-\infty}^cf(x)\,dx\quad\text{and}\quad\int_{c}^{\infty}f(x)\,dx$$ to make sense separately and independently, and this to happen for every real number $c$.
So in order for $$\int_{-\infty}^{\infty}\frac{x}{1+x^2}\,dx$$ to make sense as a number, we need $$\textbf{both}\quad\int_{-\infty}^c\frac{x}{1+x^2}\,dx\quad\textbf{and}\quad \int_{c}^{\infty}\frac{x}{1+x^2}\,dx\quad\textbf{to each make sense for every }c.$$
However, $$\int_c^{\infty}\frac{x}{1+x^2}\,dx$$ does not exist for any value of $c$, so we cannot make sense of $$\int_{-\infty}^{\infty}\frac{x}{1+x^2}\,dx$$ as a number.
Now, it is tempting to say that since the function is odd and the interval is symmetric about the origin, the integral "should" be equal to $0$. Unfortunately, that runs into serious trouble pretty soon. Consider for example trying to argue that way with $$\int_{-\infty}^{\infty}\sin x\,dx.$$ Okay, that "should" be $0$ because $\sin x$ is an odd function. However, I claim that in fact, the integral "should" be $2$. Why? Well, $$\begin{align*} \int_{-\infty}^{\infty}&\sin x\,dx\\ &= \cdots + \int_{-4\pi}^{-2\pi}\sin x\,dx +\int_{-2\pi}^0\sin x\,dx + \int_{0}^{\pi}\sin x\,dx +\int_{\pi}^{3\pi}\sin x\,dx + \int_{3\pi}^{5\pi}\sin x\,dx + \cdots \end{align*}$$ now, every integral except for $\int_{0}^{\pi}\sin x\,dx$ is equal to $0$; and $$\int_0^{\pi}\sin x\,dx = 2.$$ So, "clearly", the whole integral, $\int_{-\infty}^{\infty}\sin x\,dx$ "should" equal $2$, not $0$. And by choosing other ways of breaking up $(-\infty,\infty)$, I could give you good reasons why the integral "should be" any particular number you want between $-2$ and $2$.
This just won't do; and so we solve the problem by reaching the only conclusion possible: the original integral simply does not exist. Just because our function is odd is not enough reason to conclude the integral "should" be $0$.