Let $d>1$ be square-free, and $K=\mathbf Q(\sqrt{-d})$. Choose an embedding of $K$ in $\mathbf C$, and let $E = \mathbf C/\mathcal O_K$. It is known that $E$ admits a model over the Hilbert class field $H$ of $K$. Let it be given such a model. Let $I \subseteq \mathcal O_{H}$ be the bad reduction locus of $E$ (i.e. the product of the primes of $H$ where $E$ has bad reduction). Let $(n) = N_{H/\mathbf Q}(I)$. (Note: I am just as happy if you take $(n) = I \cap \mathbf Q$ instead.)
What is known about $n$, as a function of $d$?
Can one say what its prime factors are, or at least narrow down the possibilities? Or, if that is too hopeful:
Can one give an upper bound on $n$ in terms of $d$? (Perhaps by cleverly estimating the growth of $j(\tau)$ along vertical half-lines?) Can one give an upper bound on the largest prime factor of $n$?
The following question is the one I am most interested in: for a given prime $p$, is it true that $p$ divides almost all numbers $n(d)$? In other words, do almost all CM curves have bad reduction at some prime above $p$? (One might expect small primes to divide the numbers $n(d)$ very frequently, and since every prime is small...)
I searched the literature for something that might help, but I didn't find anything very explicit. Thank you in advance for anything that might help.
Your question is not well-defined. For instance, let $d=3$, let $K=\mathbb{Q}(\sqrt{-3})$, and let $\mathcal{O}_K$ be the ring of integers of $K$. Let $E=\mathbb{C}/\mathcal{O}_K$. Then, $j(E)=0$, and conversely, every elliptic curve $E'$ (over $\mathbb{C}$) with $j$-invariant equal to $0$ is isomorphic (over $\mathbb{C}$) to $E$, and $E'$ has complex multiplication by $\mathcal{O}_K$. So let $d$ be square-free, and let take $E'=E'_d$ to be given by $$E'_d: y^2=x^3+d.$$ Then $E'_d$ has $j(E'_d)=0$, and therefore it has CM by $\mathcal{O}_K$. For the curve $E'$ the bad primes are possibly $2$ and $3$, but definitely every prime divisor $p>3$ of $d$. In particular, for any prime $p$ you can find an elliptic curve over $\mathbb{Q}$ with complex multiplication by $\mathcal{O}_K$, with bad reduction at $p$. (Notice that $H=K$ in this case, and $E'_p/K$ also has bad reduction at primes above $p$, for $p>3$.)
Thus, in general, you may want to specify a certain elliptic curve with CM by $\mathcal{O}_K$, defined over $H=K(j(E))$, the Hilbert class field of $K$, and "minimal discriminant", or perhaps an intersection of all the loci of bad reduction... but this cannot be done either. Because if you have an elliptic curve $E$ defined over $H$ with CM by $\mathcal{O}_K$, and $\wp$ is any prime of $H$, then there is always an elliptic $E'$ also defined over $H$, and isomorphic to $E$ over $\overline{H}$ such that $E'$ has good reduction at $\wp$ (this is Corollary 5.22 in Rubin's "Elliptic Curves with Complex Multiplication and the Conjecture of Birch and Swinnerton-Dyer").
In the example above, and back to $K=\mathbb{Q}(\sqrt{-3})$, you may believe that $y^2+y=x^3$, which has CM by $\mathcal{O}_K$ and discriminant $-27$ gives you the "minimal discriminant" you want, and that the "minimal locus of bad reduction" is $3$, but you would be wrong, because among all elliptic curves with CM by $\mathcal{O}_K$ and defined over $H=K(j(E))=K$ there is $$E':y^2 + 2y = x^3 + (\sqrt{-3} + 3)x^2 + (2\sqrt{-3} + 2)x + (\sqrt{-3} - 1)$$ which has discriminant $2^4$ and therefore it has good reduction at $3$!