  We prove three results about semialgebraic hypergraphs. First, we prove an
optimal and oblivious regularity lemma. Fox-Pach-Suk proved that the class of
$k$-uniform semialgebraic hypergraphs satisfies a very strong regularity lemma
where the vertex set can be partitioned into $\mathrm{poly}(1/\varepsilon)$
pieces so that all but an $\varepsilon$-fraction of $k$-tuples of parts are
homogeneous (either complete or empty). Our result improves the number of parts
in the partition to $O_{d,k}((D/\varepsilon)^{d})$ where $d$ is the dimension
of the ambient space and $D$ is a measure of the complexity of the hypergraph;
additionally, the partition is oblivious to the edge set of the hypergraph. We
give examples that show that the dependence on both $\varepsilon$ and $D$ is
optimal.
  From this regularity lemma we deduce the best-known Tur\'an-type result for
semialgebraic hypergraphs. We show that any such hypergraph with $N$ vertices
and $\varepsilon N^k$ edges contains a complete $k$-uniform $k$-partite
subhypergraph with $\Omega_{d,k}(D^{-d(k-1)}\varepsilon^{d(k-1)+1}N^k)$ edges.
  Third, we prove a Zarankiewicz-type result for semialgebraic hypergraphs.
Previously, Fox-Pach-Sheffer-Suk-Zahl showed that a $K_{u,u}$-free
semialgebraic graph on $N$ vertices has at most $O_{d,D,u}(N^{2d/(d+1)+o(1)})$
edges and Do extended this result to $K_{u,\ldots,u}^{(k)}$-free semialgebraic
hypergraphs. We improve upon both of these results by removing the $o(1)$ in
the exponent and making the dependence on $D$ and $u$ explicit and polynomial.
  All three of these results follow from a novel "multilevel polynomial
partitioning scheme" that efficiently partitions a point set
$P\subset\mathbb{R}^d$ by low-complexity semialgebraic pieces. We prove this
result using the polynomial method over varieties as developed by Walsh which
extends the real polynomial partitioning technique of Guth-Katz.
