np.unique() explanation?
Firstly the function returns the variables u and indices:

u contains the unique elements sorted. In other words no element is repeated (the number 2 does not appear twice) and the elements will be listed from the smallest to the largest value
indices is the same size as a and basically it contains the index in u you should used to recover a. So when they give you [0,1,3,2,1], in this case the number 3 refers to the 3rd index of u = [1, 2, 3, 5] which in this case is 5

You can see how u and indices can be used to recover a by running the following code:
for element in indices:
      print(u[element])

This also explains your last question: u[indices] it basically gives you back a. Note that in your question u[indices] should return array([1, 2, 5, 3, 2]). I assume you made a typo