  Let $\mathbb{F}_q$ be a finite field with $q=p^t$ elements. In this paper, we
study the number of solutions of equations of the form $a_1 x_1^{d_1}+\dots+a_s
x_s^{d_s}=b$ over $\mathbb{F}_q$. A classic well-konwn result from Weil yields
a bound for such number of solutions. In our main result we give an explicit
formula for the number of solutions for diagonal equations satisfying certain
natural restrictions on the exponents. In the case $d_1=\dots=d_s$, we present
necessary and sufficient conditions for the number of solutions of a diagonal
equation being maximal and minimal with respect to Weil's bound. In particular,
we completely characterize maximal and minimal Fermat type curves.
