Use the ^ character (shift-6), known as a caret, to create exponents:
$x^2$
produces
If you have an exponent containing more than one character, group the exponent characters inside braces.
$x^21 \ne x^{21}$
produces
Similarly, subscripts are created using the _ (underscore character).
Again, for subscripts of more than one character, use braces to
indicate where the subscript starts and stops.
$x_21 \ne x_{21}$
produces
Practice:
Create a document containing formulas using exponents and subscripts.