  We prove nilpotency results for Lie algebras over an arbitrary field
admitting a derivation, which satisfies a given polynomial identity $r(t)=0$.
For the polynomial $r=t^n-1$ we obtain results on the nilpotency of Lie
algebras admitting a periodic derivation of order $n$. We find an optimal bound
on the nilpotency class in characteristic $p$ if $p$ does not divide a certain
invariant $\rho_n$. We give a new description of the set $\mathcal{N}_p$ of
positive integers $n$, introduced by Shalev, which arise as the order of a
periodic derivation of a finite-dimensional non-nilpotent Lie algebra in
characteristic $p>0$. Finally we generalize the results to Lie rings over $\Bbb
Z$.
