There are two complete sets of envelopes that contain the names of the winners. One accountant has one set, another accountant has the other set. They're on opposite sides of the stage because the presenters enter from alternating sides.
The problem is, this means that when a presenter enters from one side, the accountant on the other side has to "burn" the envelope for that category. For example, for the Best Actress category, one accountant gave the envelope with Emma Stone's name in it to Leonardo DiCaprio, and on the other side of the stage the other accountant should have set aside his/her envelope for Best Actress. But for one reason or another, that didn't happen.
Then, for the next category, Best Picture, the accountant that didn't properly dispose of their Best Actress envelope gave that envelope to Warren Beatty. So then Beatty opens that envelope and is confused. It says Emma Stone, La La Land. Too bad he didn't look a little further -- the envelope said Best Actress in a Leading Role on it, and the card also had the category name in small print. He showed the card to Faye Dunaway and (maybe thinking Emma Stone produced the movie?), seeing "La La Land" on the card, she announces La La Land as the winner of Best Picture.
Then eventually there's mayhem, and the right envelope is found, and the correct winner is announced.
Dunaway didn't somehow get "La La Land" from a card that clearly said "Moonlight". And there weren't three Best Picture envelopes. There was an extra Best Actress envelope that never should have been given to Warren Beatty, and there were two Best Picture envelopes.
Pretty simple.
Now, does any of this mean this wasn't planned? No. I don't think it was. I don't think you destroy the integrity of your organization, its award show, or the accounting firm that handles the voting, just for a possible slight increase in future ratings.