# Addition of a methyl group to a heterobicyclic ring [closed]

I am battling to understand how this reaction works. It should be a carbonyl addition reaction but I am not 100% sure how to reach each step. Could someone explain the mechanism to me?

Here, the lone pair on $\ce{N}$ is in conjugation with the double bond.So, during formation of the first product, the lone pair delocalises and as a canonical form, a carbanion is formed which acts like a Nucleophile and performs $\ce{S_N2}$ with $\ce{CH_3I}$.
For the formation of the next two products, $\ce{K_2CO_3}$ acts like a base and abstracts a proton from the methyl substitued carbon. That abstraction forms a carbanion which is also in conjugation with a double bond and hence it's stable. The next two products are actually both $\ce{S_N2}$ products, but the nucleophilic centre are change due to that negative charge delocalisation.