Why is it true that $\int_0^\infty \sin(qx) dx = 1/q$. In a Quantum Mechanics class the professor pointed out a calculation from Zetilli's textbook on Quantum Mechanics (page 630).
There he says that:
$$\int_0^\infty \sin(qx) dx = \lim_{\lambda \to 0} \int_0^\infty e^{-\lambda x} \sin(qx) dx$$
Then he writes the $\sin$ as complex exponentials and reaches the result that the integral is $1/q$. WHAT? I was taught at my calculus course that this integral does not converge. For me this result is plain wrong, and I do not understand it at all. I even don't see why the limit can be imposed like that. Any thoughts on this "trick"?
 A: I think this is called either dimensional reduction, exponential regularization, or laplace (transform) regularization. The integral does not converge in any classical sense, but we are defining it via the above exponential regularization. This is a fairly common technique (trick?) in physics, where integrals tend to diverge without such considerations. The idea is that the integral with the exponential defines an analytic function for $\lambda>0$ and can be "extended" to $\lambda\rightarrow 0$. 
This is not entirely unjustified because rarely do physical quantities oscillate as such to infinity. For example in an electromagnetic cavity, even though we assume an infinite sequence of modes exist, their energies would be ridiculous so there has to be some kind of cutoff or regularization. Feynman integrals are notorious for this kind of divergence (ultraviot and infrared divergenve especially), so that's why there's a flurry of regularization techniques to assign sensible values to them. 
A: Since
$$
\newcommand{\Im}{\operatorname{Im}}
\int_0^\infty\sin(qx)\,\mathrm{d}x=
\Im\left(\int_0^\infty e^{iqx}\,\mathrm{d}x\right)\tag1
$$
in the spirit of analytic continuation, we can look at
$$
f(q)=\int_0^\infty e^{iqx}\,\mathrm{d}x\tag2
$$
which is well-defined for $\Im(q)\gt0$, and see how $f$ behaves as $\Im(q)\to0$.
When $\Im(q)\gt0$, we get, via contour integration,
$$
\begin{align}
f(q)
&=\frac iq\int_0^{-iq\infty} e^{-x}\,\mathrm{d}x\tag{3a}\\
&=\frac iq\int_0^\infty e^{-x}\,\mathrm{d}x\tag{3b}\\
&=\frac iq\tag{3c}
\end{align}
$$
Explanation:
$\text{(3a)}$: substitute $x\mapsto\frac{ix}q$
$\text{(3b)}$: integration over $\gamma=[0,R]\cup[R,-iqR]\cup[-iqR,0]$ is $0$
$\text{(3c)}$: integrate

Then, by analytic continuation, as $\Im(q)\to0$, $\frac iq$ behaves nicely. Therefore, we say for real $q$:
$$
\int_0^\infty(\cos(qx)+i\sin(qx))\,\mathrm{d}x=\frac iq\tag4
$$
which says not only that $\int_0^\infty\sin(qx)\,\mathrm{d}x=\frac1q$, but also that $\int_0^\infty\cos(qx)\,\mathrm{d}x=0$ (even though neither of these integrals converges in the classical sense).

Let's verify the integral of $\cos(qx)$:
$$
\begin{align}
\int_0^\infty\cos(qx)\,\mathrm{d}x
&=\int_0^\infty\sin(\pi/2+qx)\,\mathrm{d}x\tag{5a}\\[6pt]
&=\int_{\frac\pi{2q}}^\infty\sin(qx)\,\mathrm{d}x\tag{5b}\\
&=\color{#C00}{\int_0^\infty\sin(qx)\,\mathrm{d}x}\color{#090}{-\int_0^{\frac\pi{2q}}\sin(qx)\,\mathrm{d}x}\tag{5c}\\[3pt]
&=\color{#C00}{\frac1q}\color{#090}{+\left.\frac1q\cos(qx)\,\right|_0^{\frac\pi{2q}}}\tag{5d}\\[9pt]
&=0\tag{5e}
\end{align}
$$
Explanation:
$\text{(5a)}$: $\cos(x)=\sin(\pi/2+x)$
$\text{(5b)}$: substitute $x\mapsto x-\frac\pi{2q}$
$\text{(5c)}$: difference of integrals
$\text{(5d)}$: integrate
$\text{(5e)}$: evaluate
A: Not an answer, just a long comment
If we consider the sum of a series in a different way (Cesàro summation), then
$$\sum_{n=1}^{\infty} \sin n x=\frac{1}{2} \cot \left(\frac{x}{2}\right)$$
Indeed
$$S_k=\sum _{i=1}^k \sin (i x)\csc \left(\frac{x}{2}\right) \sin \left(\frac{k x}{2}\right) \sin \left(\frac{1}{2} (k+1) x\right)$$
and
$$\frac{1}{n}\sum _{k=1}^n \csc \left(\frac{x}{2}\right) \sin \left(\frac{k x}{2}\right) \sin \left(\frac{1}{2} (k+1) x\right)=\\=\frac{1}{4n}\csc \left(\frac{x}{2}\right) \left(2 n \cos \left(\frac{x}{2}\right)-\csc \left(\frac{x}{2}\right) \sin ((n+1) x)+\sin (x) \csc \left(\frac{x}{2}\right)\right)$$
and finally
$$\underset{n\to \infty }{\text{lim}}\frac{1}{4n}\csc \left(\frac{x}{2}\right) \left(2 n \cos \left(\frac{x}{2}\right)-\csc \left(\frac{x}{2}\right) \sin ((n+1) x)+\sin (x) \csc \left(\frac{x}{2}\right)\right)=\frac{1}{2} \cot \left(\frac{x}{2}\right)$$
A: The mean value of the integral as the upper bound goes to infinity is $1/q$. The Abel regularization in your source is essentially finding the mean value.
