Protocol. Alice sends each photon with a random bit in a random basis: rectilinear (0 deg / 90 deg) or diagonal (45 deg / 135 deg). Bob measures in a random basis. If his basis equals Alice's he gets her bit; otherwise his result is random (50 %). They publicly compare bases only, keep the matching half (the sifted key) and discard the rest.
Why eavesdropping shows. An intercept-resend spy Eve must guess a basis. The no-cloning theorem prevents her from copying the photon. When she guesses wrong (50 %) she sends a photon in the wrong basis and Bob, if he uses Alice's basis, errs half of the time. So Eve adds an error rate f/4 to the sifted key (25 % if she listens to everything). Independent channel errors p add too; the exact result is
Key rate. With ideal single photons and an asymptotically long key, the Shor-Preskill bound gives the secret fraction r = 1 - 2 h(Q), h(Q) = -Q log2 Q - (1-Q) log2 (1-Q). It reaches zero at Q ~ 11 %, so above this the parties must abort. Error correction costs h(Q) bits per sifted bit and privacy amplification costs another h(Q).
Simplifications: perfect single-photon sources and detectors (real systems use weak laser pulses plus decoy states, since multi-photon pulses allow photon-number-splitting attacks), only the intercept-resend attack, no photon loss or dark counts, all sifted bits used for the error estimate here (real systems sample a subset), and the asymptotic rather than a finite-key bound.