\documentclass{article}
\usepackage{amsmath}
\begin{document}
Fractions in text
$\frac{a}{b}$
$\tfrac{a}{b}$
$\dfrac{a}{b}$

Displayed fractions
\[\frac{a}{b}\]
\[\tfrac{a}{b}\]
\[\dfrac{a}{b}\]

Exponents in fractions
\[ \frac{a^n}{b^n} \]
\[ \frac{a_{n+1}}{b^n} \]
\[ a^n \over b^n \]
\[ a^{n+1} \over b^n \]

Exponents in nested fractions
\[ \frac{\frac{a^n}{b^m}}{\frac{c^n}{d^m}} \]
\[ \frac{a^n}{b^m} \over \frac{c^n}{d^m} \]
\[ \frac{{a^n \over b^m}}{{c^n \over d^m}} \]
\[ {a^n \over b^m} \over {c^n \over d^m} \]
\[ {a^{n+1} \over b^m} \over {c^n \over d^m} \]

Fractions in exponents in fractions
\[ \frac{a^{\frac{1}{2}}}{b^{\frac{2}{3}}} \]
\[ a^{\frac{1}{2}} \over b^{\frac{2}{3}} \]
\[ \frac{a^{1 \over 2}}{b^{2 \over 3}} \]
\[ a^{1 \over 2} \over b^{2 \over 3} \]
\[ a^{{1+2} \over 2} \over b^{2 \over 3} \]

Fractions in exponents in nested fractions
\[ \frac{\frac{a^{\frac{1}{2}}}{b^{\frac{2}{3}}}}{\frac{c^{\frac{1}{2}}}{d^{\frac{2}{3}}}} \]
\[ \frac{a^{\frac{1}{2}}}{b^{\frac{2}{3}}} \over \frac{c^{\frac{1}{2}}}{d^{\frac{2}{3}}} \]
\[ {a^{\frac{1}{2}} \over b^{\frac{2}{3}}} \over {c^{\frac{1}{2}} \over d^{\frac{2}{3}}} \]
\[ {a^{1 \over 2} \over b^{2 \over 3}} \over {c^{1 \over 2} \over d^{2 \over 3}} \]
\[ {a^{{1+2} \over 2} \over b^{2 \over 3}} \over {c^{1 \over 2} \over d^{2 \over 3}} \]

\end{document}
