I want to understand something about the derivation of $\text{Var}(X) = E[X^2] - (E[X])^2$
Variance is defined as the expected squared difference between a random variable and the mean (expected value): $\text{Var}(X) = E[(X - \mu)^2]$
Then:
$\operatorname{Var}(X) = E[(X - \mu)^2]$
$\operatorname{Var}(X) = E[(X - E[X])^2]$
$\operatorname{Var}(X) = E[(X - E[X])(X - E[X])]$
$\operatorname{Var}(X) = E[X^2 - 2XE[X] + (E[X])^2]$
$\operatorname{Var}(X) = E[X^2] - 2E[XE[X]] + E[(E[X])^2]$
$\operatorname{Var}(X) = E[X^2] - 2E[E[X]E[X]] + E[(E[X])^2]$
$\operatorname{Var}(X) = E[X^2] - 2(E[X])^2 + (E[X])^2$
$\operatorname{Var}(X) = E[X^2] - (E[X])^2$
What I don't quite understand is the steps that get us from $E[XE[X]]$ to $E[E[X]E[X]]$ to $(E[X])^2$, also $E[(E[X])^2]$ to $(E[X])^2$.
While I'm sure these jumps are intuitive and obvious I would still like to understand how we can (more formally) make these jumps / consider them mathematically equivalent.