# How does the teleportation circuit work after the initial entanglement?

I'm trying to understand why we do what we do when we teleport a state from Alice's first qubit to Bob's qubit. I understand the initial entanglement, but could use help walking through the program.

I have a teleportation circuit,

circuit = QuantumCircuit(3,3) First, I create the bell pair for Alice and Bob:

circuit.h(1)
circuit.cx(1,2) Then, I flip alices first qubit to a 1 state; this is the qubit whose state is to be teleported:

circuit.x(0) Then, my understanding gets fuzzy, and I have a few questions.

1) I seem to entangle Alice's to-be-teleported state qubit with her qubit that is entangled with Bob's. But what exactly am I doing when I conditionally flip this to-be-teleported qubit and then put a hadamard on it?

circuit.cx(0,1)
circuit.h(0) and then 2) how does my measurement affect Bob's qubit?

circuit.measure([0,1],[0,1]) finally, 3) why do I again conditionally flip Alice's second qubit with Bob's qubit and then conditionally rotate Alice's to-be-teleported qubit with Bob's qubit?

circuit.cx(1,2)
circuit.cz(0,2) Here is the whole circuit, for reference: 