Draw curve for $H(x) = \int_{-\infty}^{\infty} \frac{x}{t^2 + x^2} dt$ Problem:
Draw the curve for $y = H(x), x \in \mathbb{R}$ where
$$H(x) = \int_{-\infty}^{\infty} \frac{x}{t^2 + x^2} dt$$
Attempted solution:
The hint I have been given is to first calculate the integral for $x>0$, then use the result to get $H(x)$ even for negative $x$.
I assume that this could just be integrated without much effort (variable substitution with $u = t^2 + x^2$ and $du = 2x~dx$):
$$H(x) = \int_{0}^{\infty} \frac{x}{t^2 + x^2} dt = \Big[\frac{1}{2} \ln(t^2 + x^2) \Big]_0^\infty$$
(Here I am assuming that $t$ is just a constant.)
However, this seems to diverge. So it is unclear how I can get from a divergent integral to the function.
The expected solution is that:
$H(x) = \pi, x > 0 $
$H(x) = 0, x = 0 $
$H(x) = -\pi, x < 0 $
Why does this approach does not work? What are some other productive calculus-based approaches (cannot be more difficult than basic single variable calculus)?
 A: For any $a > 0$, let's consider:
$$H(x,a) = \int_{-a}^{a} \frac{x}{t^2 + x^2} dt = \left.\arctan\left(\frac{t}{x}\right)\right|_{t = -a}^{t = +a} = \arctan\left(\frac{a}{x}\right) - \arctan\left(\frac{-a}{x}\right) = \\=2\arctan\left(\frac{a}{x}\right),$$
since $\arctan(-y) = -\arctan(y).$
Now for $x \neq 0$:
$$H(x) = \lim_{a \to +\infty} H(x,a) = \lim_{a \to +\infty} 2\arctan\left(\frac{a}{x}\right) = \begin{cases}
2 \cdot \frac{\pi}{2} = \pi & ~\forall x > 0,\\
2 \cdot \left(-\frac{\pi}{2}\right) = -\pi & ~\forall x < 0,
\end{cases}$$
since
$$\lim_{y \to \pm\infty} \arctan(y) = \pm\frac{\pi}{2}.$$
Instead, for $x=0$, we get that:
$$H(0,a) = \int_{-a}^{a} \frac{0}{t^2 + 0^2} dt = 0,$$
for all $a > 0$. Hence, also $H(0) = \lim_{a \to +\infty} H(0,a) = 0$. 
Summarizing:
$$H(x) = \begin{cases}
-\pi & ~\forall x < 0\\
0 & x = 0\\
\pi & ~\forall x > 0
\end{cases}.$$
A: That integrand is almost the derivative of arctangent.  The change of variables $t \rightarrow ux$ would seem to be a way to get started.
(Noticed this two ways: First, that integrand really is almost the derivative of arctangent.  Second, arctangent is bounded above by $\pi/2$, passes through $(0,0)$, and is bounded below by $-\pi/2$, so your expected properties of $H$ matched well.)
