Let $K=\mathbb{Q}(\sqrt{d})$ for $d$ square free integer and let $p$ be a rational prime such that $p$ does not divide $2d$. Prove that $p\mathcal{O}_K$ is a prime ideal $\iff x^2\equiv_p d$ has no solution.
I'm completely stuck with this. I know that for $\mathbb{Q}(\sqrt{d})$, the ring of integers $$\mathcal{O}_K= \begin{cases}\mathbb{Z}[\sqrt{d}]\qquad \quad d\equiv_4 2,3\\ \mathbb{Z}\left[\frac{1+\sqrt{d}}{2}\right]\quad d\equiv_4 1\end{cases}$$ and also that the ring of integers of a number field is Dedekind. I also know that for an ideal $\mathfrak{a}$ of a ring $A$ to be prime, $xy \in \mathfrak{a} \implies x \in \mathfrak{a}$ or $y \in \mathfrak{a}$ for all $x,y \in A$.
I just don't see how this corresponds to congruences of $x$. If $p$ does not divide $2d$ and $p$ generates the ideal $p\mathcal{O}_K$, then does this imply the result? I feel like the $2$ in $2d$ is relevant to the $2$ in $x^2$ but I just can't piece this problem together.
For instance, I start with the forward direction: If $z \in \mathcal{O}_K$, then $pz \in p\mathcal{O}_K$. But if $p\mathcal{O}_K$ is prime, that means $p \in p\mathcal{O}_K$ or $z \in p\mathcal{O}_K$. I have no idea where to go from here!
EDIT: I have found a result that states $\left(\frac{d}{p}\right)=-1$ (i.e. $x^2 \neq d \mod p$) $\iff$ odd $p$ remains prime, since:
$$\frac{\mathbb{Z}\left[\frac{1+\sqrt{d}}{2}\right]}{p\mathbb{Z}\left[\frac{1+\sqrt{d}}{2}\right]} \cong \frac{\mathbb{Z}\left[\sqrt{d}\right]}{p\mathbb{Z}\left[\sqrt{d}\right]} \cong \frac{\mathbb{Z}[x]}{(p,x^2-d)} \cong \frac{\mathbb{F}_p[x]}{(x^2-d)}$$
Thus I think this reduces the problem to proving $p\mathcal{O}_K$ is a prime ideal $\iff$ $p$ prime in $K=(\mathbb{Q}\sqrt{d})$.
Is this a fair assumption? If so, I have the proof for the backward direction as: $ab \in p\mathcal{O}_K \implies p|ab$ since $p$ is prime $\implies p|a$ or $p|b \implies a \in p\mathcal{O}_K$ or $b \in p\mathcal{O}_K$ and the forward direction as analogous.
Is this a correct approach?
Here is another method that perhaps you will like more? (It is a method I learned from P. Samuel.)
We start with $K=\mathbb{Q}(\sqrt{d})$. We use the fact that $\mathcal{O}_K = \mathbb{Z} + \mathbb{Z}\sqrt{d}$ (notation used here: $\mathcal{O}_K$ is a free module over $\mathbb{Z}$ with basis $1$ and $\sqrt{d}$) if $d\equiv 2,3 ~ (4)$, and $\mathcal{O}_K = \mathbb{Z} + \mathbb{Z} \tfrac{1+\sqrt{d}}{2}$ if $d\equiv 1 ~ (4)$.
Let $p$ be an odd prime and consider $p\mathcal{O}_K$, the ideal generated by $p$ in the ring of integers. Let us examine the quotient ring $\mathcal{O}_K/p\mathcal{O}_K$, depending on the two cases of $d$.
In the first case, (use the map $X\mapsto \sqrt{d}$ , to get the ring isomorphism) $$ \mathcal{O}_K \simeq \mathbb{Z}[X]/(X^2-d) $$ Therefore, as you said, $$ \mathcal{O}_K/p\mathcal{O}_K \simeq \mathbb{Z}[X]/(p,X^2-d) \simeq \mathbb{F}_p[X]/(X^2-\overline{d}) $$
On the other hand, if $p\mathcal{O}_K = \mathfrak{b}_1^{e_1} .\mathfrak{b}_2^{e_2}$ is the factorization of this ideal in the ring of integers, then by the Chinese remainder theorem, $$ \mathcal{O}_K/p\mathcal{O}_K \simeq \mathcal{O}_K/\mathfrak{b}_1^{e_1} \times \mathcal{O}_K/\mathfrak{b}_2^{e_2} \implies \mathbb{F}_p[X]/(X^2-\overline{d}) \simeq \mathcal{O}_K/\mathfrak{b}_1^{e_1} \times \mathcal{O}_K/\mathfrak{b}_2^{e_2}$$
(The only possibilities is that: (i) either $e_1=e_2=1$, (ii) either there is no $e_2$, only $e_1=2$, (iii) either there is no $e_2$, only $e_1$, with $e_1=1$).
If $\overline{d} = 0 \in \mathbb{F}_p$ then $\mathbb{F}_p[X]/(X^2-\overline{d}) = \mathbb{F}_p[X]/(X^2)$, in particular this ring has nilpotent elements. Comparing it with the isomorphic ring, this can only happen in case (ii). But then that is saying that $p$ ramifies.
If $\overline{d} \not \in \mathbb{F}_p^{\times 2}$ then $\mathbb{F}_p[X]/(X^2-\overline{d})$ is a field. Therefore, the only such possibility is that of case (iii). (Because a product of two fields is never a field). But then that is saying that $p$ is inert.
If $\overline{d} \in \mathbb{F}_p^{\times 2}$ then $(X^2-\overline{d}) = (X-\overline{a})(X-\overline{b})$, hence $\mathbb{F}_p[X]/(X^2-\overline{d})$ is isomorphic to $ \mathbb{F}_p[X]/(X-\overline{a}) \times \mathbb{F}_p[X]/(X-\overline{b})$, which is a product of two fields (without any nilpotent elements). The only such possible case is therefore (i), as $\mathfrak{b}_1$ and $\mathfrak{b}_2$ are maximal primes (remember, we are in a Dedekind ring). But then that is saying that $p$ splits.
I think the case $d\equiv 1 ~ (4)$ is treated similarly.