Organic chemistry · Substitution and elimination
The same lone pair can attack carbon or grab a proton, and the reagent's size and the solvent decide which it does.