a) Alkylation reaction
Pyridine reacts with alkyl halides, alkanoyl halides, and anhydrides to form pyridinium salts. The reaction proceeds through the nucleophilic attack of the lone pair of nitrogen on the electrophilic carbon of said reagents.
This alkylation reaction can only be carried out with primary and secondary substrates since the tertiary ones undergo elimination reactions.
b) Acylation reaction
The acylation mechanism occurs with a first stage of addition by nucleophilic attack of the pyridine nitrogen on the halide carbonyl. In the second stage the elimination of the halogen occurs.