Nucleophilic Substitution
Nucleophilic substitution mechanism
Nucleophile - species that donates an electron pair to form a new covalent bond
A nucleophile reacts with a polar molecule like a haloalkanes by 'kicking out’ the halogen and taken its place

Steps of nucleophilic substitution
Nucleophile approaches the haloalkanes with a partially positive C atom
Nucleophile donates its lone pair to the C atom forming a new covalent bond
Original bond between the C atom and the halogen breaks heterolytically as the halogen atom takes both shared electrons
Halogen is replaced by the nucleophile
Types of nucleophiles
OH-(Hydroxide) , CN-(Cyanide), NH3. (Ammonia)
Reaction with hydroxide to form alcohols
Haloalkanes undergo nucleophilic substition with aqueous hydroxide ions from bases like sodium hydroxide when the mixture is warmed
C2H5Br + OH- → C2H5OH + Br-

This reaction replaces the haloalkane with an alcohol product, is a type of hydrolysis reaction. Water molecule also act as a nucleophile in similar hydrolysis reactions with haloalkanes to generate alcohols. However, the reaction rate is much slower with neutral water molecules than hydroxide ions, which are more nucleophilic
Reaction with cyanide to form nitriles
Haloalkanes undergo nucleophilic substitution when reacting with ethanolic potassium cyanide. Cyanide ion acts as the nucleophiles displacing a halogen to form a nitrile
C2H5Br + CN- → C2H5CN + Br-

This reaction extends the carbon chain length of the original haloalkanes by a carbon atom
Reaction with ammonia to form amines
When heated under pressure with excess ethanolic ammonia, haloalkanes undergo nucleophilic substitution to form primary amines
C2H5Br + 2NH3 → C2H5NH2 + NH4Br

Initially the ammonia replaces the bromine atom. Subsequently, it abstracts the hydrogen from the intermediate amine, yielding the final amine product alongside ammonium bromide