Let $k$ be an algebraically closed field, $\ell$ is a prime different with characateristic of $k$, and consider the $\ell$-adic etale cohomology. We know the number of connected components of a scheme finite type over $k$ by looking at $H^0$, but how about the number of irreducible components? 


Looking at the example $\{xy=0\}$ in $\mathbb P^2$ which has $1$-dim $H^0$ and $2$-dim $H^2$, it seems that the number has something to do with top dimensional etale cohomology.


So the question is: let $X$ be a connected equidimensional finite type scheme over $k$ (of dimension $n$), when do we know $\dim\_k (H^{2n}\_{c}(X))$ is equal to the number of irreducible components of $X$ ?


The complex case is partially discussed in <https://math.stackexchange.com/questions/2393326/top-cohomology-and-irreducible-components>, but the proof does not work in positive characterisitc case.



Reference request: number of irreducible components and top dimension etale cohomology
The answer is *yes* (in fact the result also holds over separably closed fields). You can find this statement in Corollary 7.5.21 of:


Poonen - Rational points on varieties.


Poonen gives a sketch of a proof with references to details in SGA4.


