Security proof of schnorr identification scheme
I believe this is the 'Rewinding Lemma' part of Schoor identification security proof, and very well explained in the Boneh and Shoup book &quot;A Graduate Course in Applied Cryptography&quot;, pgs 727-728.
An important aspect here is that we have to consider another adversary B, who emulates (grab a digital compiled version of A) and plays/interacts with A. (we can think of B as whoever wants to break the scheme, and presupposes the existence of A):

first, B plays the role of the verifier, and expect A (playing the prover role) send w;
B send r1, and wait for the A's answer;
B rewinds A, so that A’s internal state is exactly the same as it was at the end of step 1;
B sends a random and independent r2; waits for the A answer.

So B may be ignorant about how A works, but s/he is who sets A independent challenges/answers, and takes advantage of it.