Nothing forces you to space a formula, but one convention is worth knowing: a thin space \, before the differential. Compare the two integrals below — the second is what a typesetter would print. The other spacing commands are \;, \quad and \qquad, in growing order.
Step 8 of 17 of the LaTeX tutorial. The formula of the step, \int_0^\infty e^{-x}dx = \int_0^\infty e^{-x}\,dx = 1, 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.