Suppose you're working over an algebraically closed field. If $J$ is a Jordan matrix, then one can determine the number of Jordan blocks and their sizes for any eigenvalue $\lambda$ by looking at the sequence of ranks $\operatorname{rank}(J-\lambda I)^k$ for $k=1,\ldots,m$ where $m$ is the first integer such that $\operatorname{rank}(J-\lambda I)^m=\operatorname{rank}(J-\lambda I)^{m+1}$.
I understand how this works for Jordan matrices, but not arbitrary matrices. If you're just given an arbitrary matrix $A$, and its set of eigenvalues $\{\lambda_i\}$, why does computing $\operatorname{rank}(A-\lambda_i I)^k$ for $k=1,\dots,m$ also determine the Jordan form for $A$, up to the order of blocks? Is there a reason why we may replace $A$ with its Jordan form for rank calculations?