If the slopes of side $AB$, $BC$, $CD$, $DA$ of a quadrilateral $ABCD$ are respectively $m_1, m_2, m_3, m_4$, and the diagonals (or the extended lines of them) are perpendicular, then the equation in $p$: $$(m_1m_3-m_2m_4)p^2-((m_2+m_4)(1+m_1m_3)\\-(m_1+m_3)(1+m_2m_4))p-(m_1m_3-m_2m_4)=0$$ is satisfied by both slopes of the diagonals (in case both exist) or by the only existing one.
This theorem can be proved by means of the theory of circumscribing conics (see my dummy answer below).
Does anyone know a different, more simple proof?

Let us separate it into three cases :
Case 1 : $AC$ is parallel to the $x$-axis.
We may suppose that $A(0,0),C(1,0)$, so $$AB : y=m_1x,\qquad BC:y=m_2(x-1),$$$$CD:y=m_3(x-1),\qquad DA:y=m_4x$$from which we have $$B\left(\frac{m_2}{m_2-m_1},\frac{m_1m_2}{m_2-m_1}\right),\qquad D\left(\frac{m_3}{m_3-m_4},\frac{m_3m_4}{m_3-m_4}\right)$$(note that we may suppose that $m_1\not=m_2$ and $m_3\not=m_4$.)
So, we have$$\begin{align}\text{the diagonals are perpendicular} &\implies \frac{m_2}{m_2-m_1}=\frac{m_3}{m_3-m_4} \\\\&\implies m_1m_3-m_2m_4=0\end{align}$$Therefore, the claim is true in this case.
Case 2 : $AC$ is parallel to the $y$-axis.
We may suppose that $A(0,0),C(0,1)$, so$$AB:y=m_1x,\qquad BC:y=m_2x+1,$$$$CD:y=m_3x+1,\qquad DA:y=m_4x$$from which we have$$B\left(\frac{1}{m_1-m_2},\frac{m_1}{m_1-m_2}\right),\qquad D\left(\frac{1}{m_4-m_3},\frac{m_4}{m_4-m_3}\right)$$So, we have$$\begin{align}\text{the diagonals are perpendicular} &\implies \frac{m_1}{m_1-m_2}=\frac{m_4}{m_4-m_3} \\\\&\implies m_1m_3-m_2m_4=0\end{align}$$Therefore, the claim is true in this case.
Case 3 : $AC$ is neither parallel to the $x$-axis nor parallel to the $y$-axis.
We may suppose that $A(0,0),C(1,p)$ where $p\not=0$, so$$AB:y=m_1x,\qquad BC:y=m_2(x-1)+p$$$$CD:y=m_3(x-1)+p,\qquad DA:y=m_4x$$from which we have$$B\left(\frac{m_2-p}{m_2-m_1},\frac{m_1(m_2-p)}{m_2-m_1}\right),\qquad D\left(\frac{m_3-p}{m_3-m_4},\frac{m_4(m_3-p)}{m_3-m_4}\right)$$So, we have$$\begin{align}&\text{the diagonals are perpendicular} \\\\&\implies \frac{p-0}{1-0}\times \frac{\frac{m_1(m_2-p)}{m_2-m_1}-\frac{m_4(m_3-p)}{m_3-m_4}}{\frac{m_2-p}{m_2-m_1}-\frac{m_3-p}{m_3-m_4}}=-1 \\\\&\implies p\left(\frac{m_1(m_2-p)}{m_2-m_1}-\frac{m_4(m_3-p)}{m_3-m_4}\right)=-\left(\frac{m_2-p}{m_2-m_1}-\frac{m_3-p}{m_3-m_4}\right) \\\\&\implies p\{m_1(m_2-p)(m_3-m_4)-m_4(m_3-p)(m_2-m_1)\} \\&\qquad\qquad =-(m_2-p)(m_3-m_4)+(m_3-p)(m_2-m_1) \\\\&\implies (m_1m_3-m_2m_4)p^2 \\&\qquad\qquad -((m_2+m_4)(1+m_1m_3)-(m_1+m_3)(1+m_2m_4))p \\&\qquad\qquad -(m_1m_3-m_2m_4)=0 \\\\&\implies (m_1m_3-m_2m_4)\left(-\frac 1p\right)^2 \\&\qquad\qquad -((m_2+m_4)(1+m_1m_3)-(m_1+m_3)(1+m_2m_4))\left(-\frac 1p\right) \\&\qquad\qquad -(m_1m_3-m_2m_4)=0\end{align}$$Therefore, the claim is true in this case.