Synthetic and Theoretical Studies for Cyclization Reactions to Form C-C and C-N Bonds