Teleportation is the inverse of superdense coding and is related to the fact that one cannot clone a qubit. One could say that Nature forbids copy/paste but allows cut/paste. Note that the no-cloning theorem is directly related to the quantum axiom that one cannot know everything about a state. If one could clone a qubit it would be possible to to measure different features on different clones and thus bypass the measurement axiom.
The teleportation is the same thing, one cannot have a clone but if you do break down the original (i.e. make a measurement) you can have a perfect clone elsewhere. This is logical and surprising at the same time because one naively would think it require to transmit infinite accuracy to reproduce a wave function from one place to another.

We’ll continue the tradition of using the names ‘Alice’ and ‘Bob’ for the two parties involved.

Alice has an arbitrary (unknown) state $\phi$ she wants to teleport to Bob. They share an entangled qubit pair where, as usual, Alice controls the first qubit and Bob the second.

$$\phi = a {\left|0\right\rangle } + b {\left|1\right\rangle } $$

$$\psi = \frac{1}{\sqrt{2}} \left({\left|00\right\rangle } + {\left|11\right\rangle }\right)$$

The starting state is hence:

$$ \phi \otimes \psi = \frac{1}{\sqrt{2}} (a \left|000\right\rangle a \left|011\right\rangle b \left|100\right\rangle b \left|111\right\rangle) $$

Much like the superdense coding, Alice applies the $H\otimes CNOT$ operation on the combined state. Note that this mixes the qubits while at the same time maintaining the entanglement on the last two.

$$ (H\otimes 1 \otimes 1)(CNOT\otimes 1)(\phi\otimes\psi) = \ \frac{1}{2}(\left|\,00\,\right\rangle\otimes \phi + \left|\,01\,\right\rangle\otimes \phi + \left|\,10\,\right\rangle\otimes \sigma + \left|\,11\,\right\rangle\otimes \sigma)$$

where we used

$$\sigma = a \left|0\right\rangle – b\left|1\right\rangle.$$

Now Allice applies a destructive measurement to the first two qubits which results in one of the equally probable states of the two-qubit basis. The resulting state is a number between 0 and three which she sends to Bob over a classic channel. The combination of this number with the remaining qubit leads to an identical copy of the initial $\phi$ state.

Depending on the received number Bob applies one of the following operators:

$$0 \rightarrow 1 \ 1 \rightarrow X \ 2 \rightarrow Z \ 3 \rightarrow Y$$

on his qubit and has now a fully teleported state (up to phase factor).

Again, note that the teleportation could only happen by destroying the initial state. Nature sealed all ways to peek inside her private recipes.

The Python code to reproduce all this is simple:

from sympy import *
import math
from sympy.physics.quantum.circuitplot import CircuitPlot,labeller,Mz,CreateOneQubitGate
from sympy.physics.quantum.gate import *
from sympy.physics.quantum.qasm import Qasm
from sympy.physics.quantum.qapply import qapply
from sympy.physics.quantum.qubit import Qubit
from sympy.physics.quantum.state import *
from sympy.physics.quantum.dagger import Dagger
from sympy.physics.quantum import TensorProduct
import matplotlib.pyplot as plt
%matplotlib inline

a,b = symbols('a b')
phi = qapply(a*Qubit('0') + b*Qubit('1'))
epr = qapply(Qubit('00') + Qubit('11'))/sqrt(2)

initial = qapply(TensorProduct(phi,epr)); simplify(initial)

step1 = qapply(H(2)*CNOT(2,1,0) * initial); simplify(step1)

step2 = qapply(Qubit('00')*(a*Qubit('0')+b*Qubit('1')) + Qubit('01')*(a*Qubit('0')+b*Qubit('1')) + Qubit('10')*(a*Qubit('0') - b*Qubit('1')) + Qubit('11')*(a*Qubit('0')-b*Qubit('1')))/sqrt(2); step2

# in the case of a |11> state, use the Y operator