Beatty & Dunaway head out on stage with the wrong envelope: Instead of the Best Picture envelope, they've grabbed one of the backup envelopes for Best Actress.
Beatty opens the envelope, and you can see him read it, realize it's for Best Actress, go back in the envelope for another card, doesn't see it there, starts to read the winner, stops again because it's OBVIOUSLY for Best Actress, gives it to Dunaway, who apparently thinks Beatty's just milking for laughs and straight away reads "La La Land" as the winner.
As Marc Platt is giving his acceptance speech, stage managers head out and show Jordan Horowitz and Fred Berger the real Best Picture envelope. Platt finishes his speech, motions for Berger to step to the mic. Berger declines at first, and then decides to give his acceptance speech, as Horowitz begins trying to get the Oscars for the Moonlight people.
Berger's speech winds down and ends with "We lost, by the way," at which point Horowitz takes over, tells the crew of Moonlight they actually won, reassures everyone he's not joking, invites them to come get their trophies, and snatches the envelope out of Beatty's hand to show Moonlight's rightful win to the audience.
Beatty then takes the mic and explains that he read the Best Actress card, and was confused, and that he wasn't milking for laughs.
Then the Moonlight crew gets their awards.