Why, for nilpotent Lie Algebras, is the inclusion to the derivations $x \mapsto {ad}_x$ not surjective? Let $\mathfrak g$ be a finite dimensional nilpotent Lie Algebra over a field $F$ (is characteristic zero necessary?). Why is the map $ad: \mathfrak g \to Der (\mathfrak g), x \mapsto {ad}_x$ not surjective?
One result, which is simple to show, is that there is an ideal $I$ of codimension 1 in $\frak g$ and an element $x \not\in I$ so that $x\not\in[\mathfrak g, \mathfrak g]$. So my idea is to build a derivation that has $x$ in its image, since $x$ will not be in the image of any adjoint. But here is where I am getting stuck (unless this is entirely the wrong approach).
 A: For a nilpotent Lie algebra there exists always an outer derivation, i.e., a derivation which is not of the form $ad(x)$ for some $x$. This result of Dixmier shows that the map there cannot be surjective for nilpotent Lie algebras.
As to why this is so- see the proof of Dixmier in the paper
Dixmier, J., Cohomologie des alg`ebres de Lie nilpotentes, Acta Sci. Math.
Szeged 16(1955),246–250.
A: Here is the proof from the paper by Tôgô (1967) mentioned by Dietrich. It works in arbitrary characteristic, for arbitrary nonzero nilpotent Lie algebras (possibly of infinite dimension). Let $K$ be the ground field.
Let $\mathfrak{g}$ be a nonzero nilpotent Lie algebra. Write it as semidirect product $K\ltimes\mathfrak{h}$. If $\dim(\mathfrak{g})$ is 1-dimensional, it has an obvious non-inner derivation (the identity map). Otherwise: let us show

Every nilpotent Lie algebra of dimension $\ge 2$ has an non-inner derivation $D$ such that $D^2=0$.

Proof. Let $\mathfrak{z}$ be the center of $\mathfrak{h}$; this is a nonzero ideal. For $z\in\mathfrak{z}$, define a linear endomorphism by $D_z(t,v)=tz$; clearly $D_z^2=0$. The bilinear map $(x,y)\mapsto D_z([x,y])-[x,D_zy]-[D_zx,y]$ is alternating, and vanishes when either $x$ or $y$ is in the hyperplane $\mathfrak{h}$, so is zero. So $D_z$ is a derivation.
Let us discuss when $D_z$ is inner.
First assume that $\mathfrak{z}$ is central in $\mathfrak{g}$. If $D_z=\mathrm{ad}(x)$, then $x$ centralizes $\mathfrak{h}$. If $x\notin\mathfrak{h}$, then $D_z$ is zero on both $\mathfrak{h}$ and $x$ and hence is zero, so $z=0$.
If $x\in\mathfrak{h}$, this implies $x\in\mathfrak{z}$, but being central in $\mathfrak{g}$, this forces $\mathrm{ad}(x)=0$ and again $D_z=0$, so $z=0$.
In general, if $D_z$ is inner, this argument can be done in the quotient $\mathfrak{g}/[\mathfrak{g},\mathfrak{z}]$ and shows that $z\in [\mathfrak{g},\mathfrak{z}]$. In other words, if $z\in\mathfrak{z}\smallsetminus [\mathfrak{g},\mathfrak{z}]$, then $D_z$ is a non-inner derivation.
Since $\mathfrak{g}$ is nilpotent, we have $[\mathfrak{g},\mathfrak{z}]$ properly contained in $\mathfrak{z}$, so we can find such $z$. $\quad\Box$

Remark. From Magnin's tables, the Lie algebra of outer derivations of any complex nilpotent Lie algebra of dimension in $\{2,3,4,5,6,7\}$ has dimension $\ge 3$, and $\ge 4$ with the exception of a single 6-dimensional case (this dimension appears in the tables as the dimension of $H^1$ of the adjoint cohomology). I don't know whether it can be smaller in higher dimension.
