Mechanistic Investigations Of Chemical And Photochemical Reactions With Quantum Chemistry And Machine-Learning Tools