Why do carbocations rearrange?
One salient factor (among others) that stabilizes carbocations (and radicals) is hyperconjugation: the inductive donation of electron density from adjacent
To be sure, when there are bonds aligned with an empty p-orbital, such as the case you've given me, their electrons can fill the orbital transiently via induction,
Organic Chemistry (2E). Klein.
Hence, during a unimolecular nucleophilic substitution or elimination reaction, when the carbocation intermediate is formed it may rearrange to stabilize the carbocation. Consider,
where a methylide shift occurs to produce a tertiary carbocation with copious hyperconjugation effects.
Note: I've omitted a lot of the details for clarity in my mechanism snippet.