An accent command puts a mark over its argument: \hat{x}, \bar{x}, \vec{v}, \dot{x}, \tilde{a}. The wide versions — \widehat, \overline, \overrightarrow — stretch over several characters, which is what you want for anything longer than one letter.
Step 11 of 17 of the LaTeX tutorial. The formula of the step, \hat{y} = \bar{x} + \vec{v}\cdot\vec{n} \quad \overline{AB}, 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.