Why is the rank of the Picard group of a K3 surface bounded above by 22? I understand that, over $\mathbb{C}$, the rank of the Picard group of a K3 surface $X$ is bounded above by $20$ because we can use the exponential sheaf sequence:
$0 \to 2\pi i \mathbb{Z} \to \mathcal{O}_X \to \mathcal{O}_X^\times \to 0$,
and because $H^1(X,\mathcal{O}_X)$ is trivial this gives an injective homomorphism $H^1(X,\mathcal{O}_X^\times) \to H^2(X,\mathbb{Z})$, and $H^2(X,\mathbb{Z})$ has rank $22$. Then, by the Lefschetz Theorem on $(1,1)$-classes, this actually embeds into $H^{1,1}(X)$, which has rank $20$ (all of these follow straight away from the definition of a K3 surface).
I know that over finite fields for instance we don't have such arguments, and the rank can be $22$.
Question: What's the proper way of stating this argument in good generality, i.e. without assuming anything about the basefield. Presumably this would involve talking about algebraic cycles. Also, why can't the rank be $21$?
 A: I will consider $X$ over an algebraically closed field $k$, and let $\ell$ be prime to the characteristic of $k$.  The Kummer sequence 
$$1 \to \mu_{\ell^n} \to \mathcal O_X^{\times} \buildrel \ell^n \over \to \mathcal O_X^{\times} \to 1$$ on the etale site of $X$ induces 
$$Pic(X)/\ell^n \to H^2(X,\mu_{\ell^n}).$$
Passing to the inverse limit over $n$ gives an injection
$$\bigl((Pic(X)/Pic^0(X)\bigr) \otimes_{\mathbf Z}\mathbb Z_{\ell} \hookrightarrow
H^2(X,\mathbb Z_{\ell})(1).$$
(Here $Pic^0(X)$ denotes the connected part of $Pic(X)$ --- which is trivial in the case of a $K3$, although we don't need this, and $(1)$ denotes a Tate twist, which is important if $X$ is base-changed from a subfield and you want to consider Galois actions, but not otherwise.)
So the bound on the Picard rank of $X$, i.e. on the rank of 
$Pic(X)/Pic^0(X)$ comes from a knowledge of the dimension of the etale cohomology
$H^2(X,\mathbb Z_{\ell}).$  This has dimension 22 in the case of a K3, hence
the desired bound (for any field $k$).  There is no better bound achievable without Hodge theoretic arguments, which aren't available in characteristic $p$.
It is helpful to consider the situation with $K3$s, and the difference between the char. $0$ and char. $p$ situations, by analogy with the case of endomorphisms 
of elliptic curves.
Indeed, the same argument as above, applied with $X$ taken to be a product of an elliptic curve  $E$ over itself, will show that the Picard rank of $E\times E$ is at most $6$,
and hence that the rank of $End(E)$ is at most $4$ --- the divisors on $E\times E$ modulo algebraic equivalence come from $E\times O$ and $O\times E$, which always contribute a rank of $2$, and then from the graphs of endomorphisms, which give the remaining rank, which hence is at most $4$.   If $E$ is supersingular in characteristic $p$ then in fact $End(E)$ is of rank $4$.  On the other hand, in characteristic $0$, Hodge theoretic arguments (or arguments with the representation $E = \mathbb C/\Lambda$, which are concrete analogues of the Hodge theoretic arguments) show that the Picard rank of $E\times E$ is bounded by $4$, and hence that the rank of $End(E)$ is at most $2$.
