some cardinal arithmetic What are the general relations between these two cardinals for $\kappa$ infinite: $\kappa^{\operatorname{cf} \kappa}$ and $2^\kappa$?
Both under GCH and failure of GCH, and $\kappa$ regular or singular.
I also do not know if under GCH this holds : $$2^\kappa=2^{\operatorname{cf}\kappa}$$
Was GCH used in this equation ?
 A: First, note $\kappa^{\operatorname{cf}\kappa}\le (2^\kappa)^{\operatorname{cf}\kappa} = 2^\kappa$, so we always have an inequality. If $\kappa$ is regular, then $\kappa^{\operatorname{cf}\kappa}=\kappa^\kappa=2^\kappa.$ If $\kappa$ is a strong limit, write $\kappa = \lim_{\alpha\to\operatorname{cf}\kappa}\kappa_\alpha$ where $\kappa_\alpha<\kappa$ and we have $$ 2^\kappa=2^{\sum_{\alpha<\operatorname{cf}\kappa}\kappa_\alpha}=\prod_{\alpha<\operatorname{cf}\kappa} 2^{\kappa_\alpha}\le \prod_{\alpha<\operatorname{cf}\kappa} \kappa = \kappa^{\operatorname{cf}\kappa}.$$ So $\kappa^{\operatorname{cf}\kappa}=2^\kappa$ whenever $\kappa$ is regular or a strong limit. Under GCH, every infinite cardinal is either regular or a strong limit, so the equality always holds.
In the absence of GCH, it is consistent that there are singular non-strong-limit cardinals where the equality fails, arbitrarily badly in a sense. For instance, it is consistent$^*$ that $\aleph_{\omega}^{\aleph_0}=\aleph_{\omega+1}$ and $2^{\aleph_\omega} >\aleph_{\omega_{\omega_5}}$ (and we could replace $\aleph_{\omega_{\omega_5}}$ with anything).
As to your second question, of course $2^{\kappa}= 2^{\operatorname{cf}\kappa}$ holds when $\kappa$ is regular, but theres no particular reason to expect it to hold when $\kappa$ is singular. For instance, if $\lambda$ is any regular cardinal, there are arbitarily large cardinals with cofinality $\lambda$ (e.g. $\aleph_{\alpha+\lambda}$ for any $\alpha$ ) and so many $\kappa > 2^\lambda$ with $\operatorname{cf}\kappa=\lambda$ which therefore have $2^{\operatorname{cf}\kappa}<\kappa < 2^\kappa.$
It also always fails at every singular strong limit cardinal since in that case we also have $2^{\operatorname{cf}(\kappa)}<\kappa.$ So GCH doesn't help... on the contrary, it guarantees that this equation fails at every singular cardinal since every singular cardinal is a strong limit under GCH.
However, in the absense of GCH, it's consistent that it holds for some singular non-strong-limit cardinals, e.g. it is consistent$^*$ that $2^{\aleph_0}=2^{\aleph_\omega}=\aleph_{\omega+1.}$

$^*$Both of these consistency statements can be obtained by Cohen forcing, starting with a model of GCH. In the first case we add $\aleph_{\omega_{\omega_5}+1}$ Cohen subsets of $\omega_1$ in order to blow up $2^{\aleph_1}$ and thus $2^{\aleph_\omega},$ while keeping $2^{\aleph_0}$ and $\aleph_\omega^{\aleph_0}$ the same. In the second case we add $\aleph_{\omega+1}$ Cohen subsets of $\omega,$ which blows up $2^{\aleph_0}$ to $\aleph_{\omega+1}$ while leaving $2^{\aleph_\omega}$ fixed at $\aleph_{\omega+1}.$
