I mean, even the most prepared DM in the world will still have unexpected things happen due to the input of the dice and the players, as you say. However, I think a well-prepared DM will be better equipped to come up with an appropriate response to an unexpected situation than an unprepared one...