TITLE: Orbit counting polynomials over finite fields
QUESTION [5 upvotes]: Let $X$ be an affine variety defined over $\mathbb{Z}$ and let $G$ be an algebraic group defined over $\mathbb{Z}$. Let $q$ be a power of a prime number. We write $\mathbb{F}_q$ for the field with $q$ elements and we define $$n_q:= \text{number of } G(\mathbb{F}_q) \text{ orbits in } X(\mathbb{F}_q).$$
Question 1: Under what condition $n_q$ has a closed formula which is a polynomial in $q$?
Question 2: In case of a positive answer for Question 1, do the coefficients of this polynomial relate to any known invariants of $X$ and $G$?
Question 3: given a polynomial with rational coefficients, is there any way to detect if it arises in the above situation?

REPLY [3 votes]: If the group $G$ is connected then there is a nice cohomological expression for the quantity $\#X(\mathbf F_q)/\#G(\mathbf F_q)$. Indeed in this case Lang's theorem implies that this equals the number of $\mathbf F_q$-points of the quotient stack $[X/G]$ (counted, as always, weighted by their stabilizer group) which can be interpreted cohomologically by the Grothendieck--Lefschetz trace formula, which was generalized to stacks by Behrend, as alluded to by Qiaochu. There is a very large literature about schemes and stacks with the property that their number of $\mathbf F_q$-points is given by a polynomial in $q$. Unless there is some "unexpected cancellation" in the cohomology, this corresponds to all cohomology groups being of Tate type.
If $G$ is disconnected then the quantity $\#[X/G](\mathbf F_q)$ is still well-behaved, but it generally not equal to $\#X(\mathbf F_q)/\#G(\mathbf F_q)$, since an $\mathbf F_q$-point of $[X/G]$ no longer has any reason to lift to an $\mathbf F_q$-point of $X$.
I doubt that you will find any nice expression or general result concerning the actual number of orbits, beyond what you get by combining the Grothendieck--Lefschetz trace formula and Burnside's lemma.