For me it is helpful to see the proof. Consider the equivalent algorithm where you reverse $0...n-k-1$, reverse $n-k...n-1$, and finally reverse $0...n-1$.
Let’s say you are rotating an array of $n$ elements by $k$. For $0 \leq i \leq n-k-1$, the new position of element $i$ is $i+k$. For $ n-k \leq i \leq n-1$, the new position of element $i$ is $i+k-n$.
Now let’s look at the transformation when following the algorithm above. For an element at position $i$, the first reverse will put that element at $n-i-1$. The third reverse will take an element at position $j\leq n-k-1$ and put it at $n-k-j-1$. Therefore, an element beginning at position $i \geq n-k-1$ will end up at $n-k-(n-i-1)-1=k+i$. A similar proof follows for the elements in the upper part of the array rotation ($i\geq n-k$).
The proof for the algorithm you posted above is essentially the same, the difference being that the elements in the sub array rotations are no longer necessarily all $\leq n-k-1$ or $\geq n-k$.