Method Development for the Palladium-Catalyzed Synthesis of Nitrogen Heterocycles and Mechanistic Analysis of Migratory Alkene Insertion into Pd-N Bonds