Preparation of Carbazoles Involving 6π-Electrocyclization, Photoredox-, Electrochemical-, and Thermal Cyclization Reactions: Mechanistic Insights.