  Using the polynomial method of Dvir \cite{dvir}, we establish optimal
estimates for Kakeya sets and Kakeya maximal functions associated to algebraic
varieties $W$ over finite fields $F$. For instance, given an $n-1$-dimensional
projective variety $W \subset \P^n(F)$, we establish the Kakeya maximal
estimate $$ \| \sup_{\gamma \ni w} \sum_{v \in \gamma(F)} |f(v)| \|_{\ell^n(W)}
\leq C_{n,W,d} |F|^{(n-1)/n} \|f\|_{\ell^n(F^n)}$$ for all functions $f: F^n
\to \R$ and $d \geq 1$, where for each $w \in W$, the supremum is over all
irreducible algebraic curves in $F^n$ of degree at most $d$ that pass through
$w$ but do not lie in $W$, and with $C_{n,W,d}$ depending only on $n, d$ and
the degree of $W$; the special case when $W$ is the hyperplane at infinity in
particular establishes the Kakeya maximal function conjecture in finite fields,
which in turn strengthens the results of Dvir.
