It was a bunch of factors, some forced.
I had a company I'd co-founded with a friend of mine, and Google would feed us work (in advertising, of course). It was getting old, and then Google terminated the program we were working under. I just couldn't get enthusiastic about searching for more clients in that field, so I floated for a bit.
During that time, I started doing ad-hoc free classes as part of a local meetup. And I networked with people at the local community college and state university. Taught a couple one-off courses as an adjunct (they always want adjuncts).
In the meantime, someone who was working for a startup bootcamp found some of my writing and reached out asking if I wanted to work there. So I joined that as an instructor.
And that worked for a while, but then the school and I began to disagree on the direction the curriculum was taking. And I decided it was time to move on. I resigned the position and floated for a bit.
Then, fortuitously, a 9-month contract (with benefits) instructor position opened up at the state university, and I went for it. And got it! I've been there 4 years now.
As for how I do teaching, I write a lot of tutorials. Hundreds of thousands of words of practice. I try to come up with effective plans, and I reflect on what worked and what didn't. I watch other instructors and copy the good stuff. I read books on instruction. I interview past students. I talk to people in industry.
I like programming because I enjoy optimization problems. And teaching is still an optimization problem. "How do I get students to realize durable learning with minimum instruction?" It's just that now what we're "programming" are squishy, non-deterministic humans. They don't always get it immediately right. :) But I love working on how to be more effective as a teacher. I think about it all day, every day.