Number of $\mathbb F_p$ points constant mod $p$? I have some affine varieties $X$ defined over $\mathbb Z$, and associated integers $c(X)$, with the property that $\# X_{\mathbb Z/p} \equiv c(X) \bmod p$ for all $p$. (In particular $c(X)$ is usually $1$ in my examples, but not always.) 

Is this property related to any other interesting properties of $X$, e.g. "ordinary", "unirational", etc.?

I am happy to entertain conjectures, necessary conditions, sufficient conditions, anything. I looked at the 33 occurrences of the word "constant" in Serre's Lectures on $N_X(p)$, but haven't delved deeper into that book.
 A: The Grothendieck-Lefschetz trace formula tells you that
$$ \#X(\mathbf F_q) = \sum (-1)^i \mathrm{Tr}(\mathrm{Frob}_q \mid H^i_c(X)),$$
where all cohomology is with coefficients in $\mathbf Q_\ell$.
Suppose all the cohomology of $X$ is of Tate type. For example, maybe there is a compactification $X \subset \overline X$ with a stratification such that the closure of each stratum has cohomology spanned by algebraic cycles. In this case,
$$ \mathrm{Tr}(\mathrm{Frob}_q \mid H^i_c(X)) \equiv \dim W_0 H^i_c(X) \pmod q,$$
 where $W$ denotes the weight filtration. Indeed, $\mathrm{Frob}_q$ acts as the identity on $W_0$ and as multiplication by $q^d$ on $\mathrm{Gr}^W_{2d}$. So in this case, your equation is satisfied, with $c(X) = \sum (-1)^i \dim W_0 H^i_c(X)$; equivalently, $c(X)$ is the Hodge-Deligne polynomial $E(X,u,v)$ specialized at $u=v=0$.
I know that Carel Faber (unpublished) used this to prove the existence of cohomology that is neither of Tate type, nor associated to Siegel modular forms of genus $\leq 3$, in the moduli space $\mathcal M_{3,n}$ for some $n$ that I can not recall. He computed the number of points mod $p$ for various $p$ and found that this was not a constant independent of $p$, nor was it a linear combination of traces on Galois representations attached to Siegel cusp forms (for the full modular group) of low enough weight and genus.
A: Do you know that $\#X(\mathbb F_q)$ is a multiple of $p$?
If you do, then for all sufficiently large primes $p$, we have
$$\zeta(X) \equiv (1-t)^{-c(X)} \mod p$$
Hence each eigenvalue of Frobenius that appears with nonzero signed multiplicity is either $1$ or is a multiple of $p$.
In terms of Galois representations, you get that each Galois representation appearing in the cohomology of $X$ with nonzero signed multiplicity is either the trivial Galois representation or has its eigenvalues multiples of $p$ for almost all primes. (Well there's small issues if eigenvalues cancel each other but let's ignore those).
This is actually related not to ordinariness but to supersingularity. For instance, a supersingular elliptic curve always has $p+1$ points. However, we believe all Galois representations are ordinary most of the time. Moreover, even if this is false, it should be very unlikely that you can find a counterexample by some fixed explicit method, so I think we can assume it is true in your case.
So I guess all Galois representations of weight $i$ that appear with nonzero signed multiplicity should have Hodge numbers in the interval $[1, i-1]$.
This is a very weak geometric condition because it only concerns cohomology, as others have pointed out. But my understanding is that varieties like fake projective planes with simple cohomology but complicated geometry are hard to construct by explicit equations.
As others suggest, rational connectedness might provide a good geometric explanation for this. If the variety is also Fano, proving that might be easier than explicitly finding rational curves - one example of varieties where there is an elementary proof of this type of congruence is varieties given by low-degree equations, which are also always Fano.
Also, note that these statements should apply not just rationally but also to the boundary divisor and to any singularities, if they occur. More precisely, it would be interesting to see if you can explicitly write your variety as a class in the Grothendieck group of smooth projective varieties. In that case possibly all varieties that occur should have that nice condition.
One interesting thing - the simplest kind of affine variety, a smooth projective variety minus a smooth divisor, can only satisfy this kind of congruence with $c(X)=0$. (I see Jason Starr has already pointed this out.) In fact it's easy to see from the $\zeta$ function that if you write your variety as a sum and difference of smooth projective connected varieties, the total number of smooth projective connected varieties must be exactly $1$. That's sort of interesting, and maybe you can see that from another angle.
A: Nobody seems to have mentioned Fulton's (?) trace formula. It says that the number of points mod p equals the alternating trace of Frobenius on coherent cohomology $H^i(X, \mathcal{O})$.  So - and this is probably exactly the same as Sawin's point- the easiest reason that the number of points is congruent to $1$ modulo $p$ is that all the higher cohomology of the structure sheaf vanishes. 
A: Firstly I would like to note that there seems to be two reasonable versions of your question:


*

*For which $X$ is $\#X(\mathbb{F}_p)$ is divisible by $p$ for any prime $p$?

*For which $X$ is $\#X(\mathbb{F}_p)$ is divisible by $p$ for any sufficiently large prime $p$?
Besides, in both of these questions one can demand  $\#X(\mathbb{F}_q)$ to be divisible by $q$ for $q$ being any power of a prime. I will denote the corresponding versions of the questions by 1' and 2', respectively.
Both of these questions are quite interesting; yet Question 1 (and 1') is more "arithmetic" and so harder to answer. Possibly I will treat it in a paper some day (thank you for asking it!).:)
So, in this answer I will mostly treat Questions 2 and 2' (that are also quite hard).
Both of the questions are "motivic" since (if we ignore a single prime $l$) they depend on  $Rx_!\mathbb{Q}_{l,X}$ (considered as a mixed complex of $\mathbb{Q}_{l}$-etale sheaves over $Spec\, \mathbb{Z}[1/l]$; here $x:X\to Spec\, \mathbb{Z}$ is the structure morphism) only. Besides, they are of "Euler characteristic type". So, ("the prime-to-$l$-part of") Question 1' and Question 2' can be easily reformulated in terms of the class of $Rx_!\mathbb{Q}_{l,X}$ in the Grothendieck ring of mixed Galois representations of $Gal(\mathbb{Q})$. Are you interested in an answer of this type
Now I will proceed to motives (and avoid fixing $l$). The class mentioned only depends on the class of the motif of $X$ (with compact support) with rational coefficients in the corresponding Grothendiek group of motives (that is also a ring). To get a sufficient condition for the first question one may consider the class of $X$ in a certain "complicated motivic Grothendieck" group over the integers.  For the second question it suffices to consider the motif with compact support of $X$ over $\mathbb{Q}$. This motif (and so, $X$ itself) has a well-defined class in the Grothendiek group of Chow motives (this is a seminal result of Gillet and Soule that answers a question of Serre; you may also have a look at my results on weight complexes and $K_0$(motives)). Thus $X$ also has a well-defined class in $K_0(Mot_{num})$. $X$ satisfies the conditions of Question 2' whenever this class is congruent to the one of a point modulo the Lefschetz motif (i.e., if $[X]-[pt]$ is the twist of an effective class).
At this stage one can ask two more natural questions:


*It this $K_0$-condition a necessary one (also for Question 2)?

*What geometric information does this condition contain?
I suspect that one can deduce the positive answer to Question 3 from certain "standard motivic" conjectures (certainly including the Tate one); yet this doesn't seem to be easy (though the Fontaine-Mazur condition could help here). 
Lastly, I would say that I do not expect any nice answers to Question 4. Certainly, the motivic conjectures predict that one can lift from $K_0(Mot_{num})$ to $K_0(Chow)$. Yet I see no way to rise from $K_0$ to motives themselves. Yet possibly I miss something here; then you may be interested in my results on Chow-weight homology: https://www.google.ru/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CB0QFjAA&url=http%3A%2F%2Farxiv.org%2Fabs%2F1411.6354&ei=dxWNVZbXO8XgyQOR8YCQCQ&usg=AFQjCNGZOey1IoXyWM5On9S2AUDnUTTmFA&sig2=nRumNYSvux2R2QblD1jcqQ&bvm=bv.96782255,d.bGQ&cad=rjt
Anyway, the motivic assertions that one can obtain this way do not seems to imply anything like rational connectedness of varieties.
