The aligned environment stacks lines and lines them up on the & marker — put it just before the equals sign of every line and the whole derivation hangs from one column. A line whose left-hand side is empty simply starts with &.
Step 14 of 17 of the LaTeX tutorial. The formula of the step, \begin{aligned} (a+b)^2 &= (a+b)(a+b) \\ &= a^2 + 2ab + b^2 \end{aligned}, opens in a live playground you can edit.
Write a LaTeX or mhchem formula and see it drawn as you type, save it as an SVG that opens again, learn the notation step by step, and practise it with graded exercises. The tool needs JavaScript, because the formulas are drawn in your browser.