Let $A$ be a $5\times 5$ complex matrix with characteristic polynomial that is $p(x)=(x-\lambda)^5$.
I've found that $$\dim\ker(A-\lambda I)=2$$ $$\dim\ker(A-\lambda I)^2=3$$ $$\dim\ker(A-\lambda I)^3=4$$ and $$\dim\ker(A-\lambda I)^4=5$$
How can I know that $A$'s Jordan form is $$\left(\begin{array}{ccccc} \lambda & 0 & 0 & 0 &0 \\ 0 & \lambda & 1 & 0 &0 \\ 0 & 0 & \lambda & 1 &0 \\ 0 & 0 &0& \lambda & 1 \\ 0 & 0 &0& 0 & \lambda \\ \end{array}\right)$$ and not $$\left(\begin{array}{ccccc} \lambda & 1 & 0 & 0 &0 \\ 0 & \lambda & 0 & 0 &0 \\ 0 & 0 & \lambda & 1 &0 \\ 0 & 0 &0& \lambda & 1 \\ 0 & 0 &0& 0 & \lambda \\ \end{array}\right)?$$
Is that because $\dim\ker (A-\lambda I)^i-\dim\ker(A-\lambda I)^{i-1}=1$ for $i=2,3,4$?
The difference between the nullity of the generalised eigenspace of index $4$ and index $3$ tells us that there is one Jordan block of degree at least $4$, i.e. there is one $J_{\lambda , 4}$ block. In your second matrix there is no $4 \times 4$ Jordan block, so that cannot be the correct form.