It figures. The year I'm rooting for the front-runner, the ode-to-Hollywood movie to win is the year Academy voters go another direction. My guesses as to why...
1) Moonlight emerged as the lone challenger but was able to skate under the radar. Have you read any critical reassessments of the film, pointing out flaws or things that didn't work? I haven't seen anything. The film didn't get the sort of attention that usually accompanies two-horse races, such as Boyhood and Birdman. I think it benefited from a disinclination to criticize the only serious Oscar contender ever that focused on a gay, black man.
2) The La La Land backlash. I underestimated this, It was an imperfect movie, but ever since its Golden Globes sweep and 14 Oscar nominations, the film's every flaw has been attacked, including its slightly dicey racial aspects (overstated in my view but definitely there). That made it more vulnerable to a film like Moonlight. It got to the point where even the film's fans felt the need to point out its flaws.
3) Everybody loves an underdog, and Moonlight was a particularly appealing one. My second choice of the nominated films I've seen was Hell or High Water, a strongly-written film set in West Texas that touched not so subtly on the fact that its white small-town characters were losing their way of life. But it never had a chance to win anything and was lucky to be nominated. It was a Red State film. Which brings me to...
4) Donald Trump was elected. I thought Academy voters would have a tough time resisting a well-made, well-reviewed valentine to Hollywood. But La La Land's escapism started to seem a bit too fluffy compared to a film like Moonlight with Trump in the White House. If Hillary Clinton had been elected, I think La La Land wins. Trump's election changed the dynamics in a way that damaged that film and gave Academy voters a chance to cast a proxy vote against Trump.
5) Moonlight's fans really, really loved it. Maybe I will too when I see it another time. But it had a base of support that thought it was wonderful and soul-stirring. Just look on this thread. Nobody said La La Land was thieir favorite film of all time, but people say that sort of thing about Moonlight. I discounted the giddy reaction in the audience to Moonlight's win at the Golden Globes. I was wrong.