Why does pyridine make such a big change from SNi to SN2?
Both cases share, that the reaction of the alcohol and the thionyl chloride yields an alkyl chlorosulfite under liberation of HCl. Then


Either the C-O bond of the alkyl chlorosulfite brakes, a (tight) ion pair of carbo-cation and chlorosulfit anion is formed.  The later decomposes into $\ce{SO2}$ and $\ce{Cl-}$, the latter reacting with the carbo-cation.  This yields the rentention of configuration observed.


.OR.


In presence of pyridine, HCl generated does not leave the reaction mixture (as above), but reacts with pyridine to yield pyridinium chloride.  Pyridinium chloride is able to react along SN2 on the alkyl chlorosulfite.  Seeing this variant from the beginning till the SN2 of the alkyl chlorosulfite yields the inversion of configuration observed.