1. Complex Analysis Technique. Consider the function
$$q(z) = i\sqrt{z-a\vphantom{d}}\sqrt{z-b\vphantom{d}}\sqrt{z-c\vphantom{d}}\sqrt{z-d\vphantom{d}}$$
for $z \in \Bbb{C}\setminus([a,b]\cup[c,d])$, where the square root $\sqrt{z} = \exp(\frac{1}{2}\log z)$ means the principal square root. By noting that
$$ \lim_{\epsilon \downarrow 0} \sqrt{-x+i\epsilon} = i\sqrt{x} \quad \text{for } x > 0, $$
we easily check that
$$ q(x+0^+i) := \lim_{\epsilon \downarrow 0} q(x+i\epsilon) = \begin{cases}
i \sqrt{|p(x)|}, & x \in (-\infty, a) \cup (d, \infty) \\
\sqrt{|p(x)|}, & x \in (a, b) \\
-i \sqrt{|p(x)|}, & x \in (b, c) \\
- \sqrt{|p(x)|}, & x \in (c, d).
\end{cases} $$
Consider an upper semicircular contour $C_{\epsilon, R}$ or radius $R$ with the center $(0, \epsilon)$. Then the Cauchy integration formula gives
$$ \oint_{C_{\epsilon, R}} \frac{dz}{q(z)} = 0. $$
By taking $R \to \infty$ and $\epsilon \downarrow 0$, it is not hard to check that
$$ 0 = \lim_{(\epsilon, R) \to (0, \infty)} \oint_{C_{\epsilon, R}} \frac{dz}{q(z)} = \int_{-\infty}^{\infty} \frac{dx}{q(x+0^+i)}. $$
By extracting the real part, we get the conclusion.
Addendum. This is a special case of the Schwarz-Christoffel mapping which sends the upper-half plane conformally into a polygonal region. In particular, the integral
$$ z \mapsto \int_{z_0}^{z} \frac{d\zeta}{q(\zeta)}, \quad \Im z, \Im z_0 > 0 $$
maps the upper-half plane into a rectangle, and the proposed identity corresponds to the fact that two opposite sides of a rectangle has the same length. This is also explained in Igor Rivin's answer in this answer.
2. Real Analysis Technique(?). Introduce the following Möbius transformation
$$\mu(t) = \frac{(ad-bc)t + (bcd-acd-abd+abc)}{(a-b-c+d)t - (ad-bc)}. $$
Then we can check (by brutal force or by any means that you would like) that
- $\mu(a) = d$, $\mu(b) = c$, $\mu(c) = b$, $\mu(d) = a$, and
- With the substitution $x = \mu(t)$,
$$ \frac{dx}{\sqrt{|p(x)|}} = -\frac{dt}{\sqrt{|p(t)|}}. $$
Therefore we have
$$ \int_{a}^{b} \frac{dx}{\sqrt{|p(x)|}} = -\int_{d}^{c} \frac{dt}{\sqrt{|p(t)|}} = \int_{c}^{d} \frac{dt}{\sqrt{|p(t)|}}. $$