Cox's model says that the hazard of a patient with predictor x is h0(t) eβx. At each death, the probability that it is this patient who dies, rather than any other patient still at risk, is eβx divided by the sum of eβx over the risk set: the baseline hazard cancels. Multiplying these probabilities over the deaths gives the partial likelihood. Move β to see how the probabilities shift towards patients with large or small x, watch Newton's method climb the log partial likelihood, and compare the three tests of β = 0.
With wi = eβxi, the log partial likelihood is the sum over deaths of βx of the patient who died minus the log of the sum of w over the risk set; its derivative is the sum of x of the patient who died minus the w-weighted mean of x over the risk set, and minus its second derivative is the sum of the weighted variances. With several deaths at one time, Breslow keeps the full risk set for each of them; Efron (R's default) removes the dying patients gradually.
code/ch11_survival_analysis.py (cox_efron_1d, cox_breslow, newton_1d) and code/ch11_lab.py (coxph).