At least from my experience on the AT, the majority of people I met were either just graduated from college (or taking a semester off), or retired. In fact, I met more retired folks than college folks.
The rest were either people who were able to creatively get lots of time off from full-time jobs, people who work seasonal jobs (that's me and a few others here, I think), teachers or folks with school related jobs (summers off), or recently laid-off/quit/etc. I'm sure there are more ways to find the time, but I think that accounts for most of it.
Of course, if you're planning the John Muir Trail, Long Trail, sections of longer trails, or any other trail that only takes a few weeks, it's a lot easier to find that kind of time off. To me, it's all about planning planning planning.