The theory of response-adaptive randomization in clinical trials