Take the discrete space $2=\{0,1\}$ and form the infinite product $2^X$ for some infinite index set $X$. The Hewitt-Marczewski-Pondiczery (HMP) theorem (Engelking 2.3.15 for example) says in this case:
Theorem (HMP): If $|X|\le2^\kappa$, then $d(2^X)<=\kappa$.
where $d(Z)$ denotes the density of a space (smallest cardinality of a dense subset). In short: $$d(2^{2^\kappa})\le\kappa$$
HMP only gives an inequality and I am interested to see if we can pinpoint the exact density value depending on the cardinality of $X$. (Assume ZFC.)
The following results seem helpful in that respect. All the cardinals below are infinite cardinals.
Fact 1: $\kappa_1\le\kappa_2$ implies $d(2^{\kappa_1})\le d(2^{\kappa_2})$
(projecting a dense set in $2^{\kappa_2}$ onto $\kappa_1$ chosen coordinates gives a dense set in the smaller space.)
Fact 2: If $d(2^X)=\lambda$, then $|X|\le 2^\lambda$
(This gives a bound for the index set based on the density. See here and https://dantopology.wordpress.com/2009/11/06/product-of-separable-spaces/)
Now based on the results above I am looking at a few cases and wondering if that can be improved. Also could the general case depend on the particular set theory assumptions one could make?
Example 1: $\aleph_0\le\kappa\le 2^{\aleph_0}=\beth_1=\mathfrak{c}$
In this case $d(2^{2^{\aleph_0}})\le\aleph_0$ by HMP and $d(2^{\aleph_0})=\aleph_0$ (Cantor set), so $d(2^\kappa)=\aleph_0$ by Fact 1.
Example 2: $\beth_1<\kappa\le\beth_2=2^{\mathfrak{c}}$
Focusing on the case $\kappa=\beth_2$, let $d(2^{\beth_2})=\lambda$. By HMP, $\lambda=d(2^{2^{\beth_1}})\le\beth_1$. Combining this with Fact 2 we get $\beth_2\le 2^\lambda\le 2^{\beth_1}=\beth_2$. So $\lambda\le\beth_1$ and $2^\lambda=\beth_2$. Can anything more precise ($\lambda=\beth_1$ ?) be deduced in this case about $\lambda$? And anything for other $\kappa$ in this range?
Example 3: $\kappa=\beth_\omega$
My knowledge of cardinal number theory is limited, so please correct anything if necessary. Let $\lambda=d(2^{\beth_\omega})$. If $\lambda<\beth_\omega$, then $\lambda\le\beth_n$ for some $n$. Then by Fact 2 we would have $\beth_\omega\le 2^{\beth_n}=\beth_{n+1}$, which is impossible. Therefore $\beth_\omega\le\lambda$. Also, combining Fact 1 and HMP $d(2^{\beth_\omega})\le d(2^{2^{\beth_\omega}})\le\beth_\omega$. So in this case we can conclude $$d(2^{\beth_\omega})=\beth_\omega$$