India, Dec. 13 -- It's tough to go back to school in your 40s. But with layoffs, stagnant pay and inroads by artificial intelligence, many of those nearing midlife are heading back to classrooms and trade schools.

Some are making radical career changes, going from chef to software engineer. Others are getting higher degrees to stand out from peers as qualification standards intensify. Some who skipped college after high school return to the classroom because they can't get top jobs without degrees.

Returning to school isn't easy. Those in their 40s often have to juggle work, family and academics. They take on new debt when peers are entering peak-earning years. The average cost of in-state public college is about $30,000 a year and much...