For something like this it can be instructive to look at a wide range of concrete examples to get a better handle on how things are actually working. The following image is a screenshot of an Excel spreadsheet with k=2, values of n from 1 to 33, and the resulting values of w and r for n=k^w+r.
As you can see, for any given value of w, r increases as n increases. Then, once n becomes big enough to require the next value of w (in this case, when n becomes the next power of 2), r goes back to zero and begins increasing again. Thus, for any given value of w, r is maximized when n is one less than the
next power of k, or k^(w+1). Mathematically, when n=k^(w+1)-1, r is maximized. So, n=k^w+r (by definition) and n=k^(w+1)-1 (when r is maximized). Equating the two expressions for n:
k^(w+1)-1=k^w+r
r=k^(w+1)-k^w-1
r=k^w(k-1)-1 (factoring k^w out of the first two terms)
r=(k-1)k^w-1
Now, you may notice that in this case, when k=2, the maximum r value can also be expressed as r=k^w-1. This, no doubt, is why it was included as an answer choice. So, if you were doing this solely by plugging numbers in, 2 may be a misleading choice for the value of k. If we look at a similar chart where k=3, it becomes clear that k^w-1 is generally not the correct expression for the maximum value of r:
Of course, you won't be able to make lengthy Excel spreadsheets when you take the actual test. The point is just to see how things work. You can see that just as with regular remainders, k-power remainders repeat in some sort of cycle. With regular remainders, if n is divided by k, the remainders cycle from 0 to k-1 as n is increased. With k-power remainders, the remainders cycle from 0 to (k-1)k^w-1. So, if you encounter some kind of atypically defined remainder on the test, you can keep in mind that the remainders will probably follow some sort of pattern like this.