Rewatching these, I still don’t understand the subplot of how the bad guys know what’s what.
In the first one (AEJ), Gandalf asks Thorin, “Who did you tell you were coming?” and Thorin says, “Nobody, I swear.”
In the second (DoS), it’s revealed that two highwaymen were in pursuit of Thorin at Bree. Other highwaymen had attempted to rob Gandalf, and he found a contract on Thorin’s head, written in the black speech. This leads to Gandalf seeking out Thorin.
But that whole arc isn’t really resolved. Was Sauron using his vision powers? It’s possible, but there’s no insinuation that is so. Nor is Sauron’s palantir mentioned.
From DoS’s opening scene in Bree, it is apparent that Sauron’s agents were pursuing Thorin from before he decided to head to Erebor. But at that point, he was just tooling around, looking for Thrain. Thrain in the books was being tortured in Dol Guldur, hence where Gandalf found him and got the map and key, but in the movies Gandalf explicitly doesn’t know anyone’s at Dol Guldur. Hence why he bumbles in and walks around in DoS.
Now that whole bit was poorly done and basically filler, but it does concretely establish Thrain and Gandalf don’t meet at Dol Guldur.
So why was Sauron looking for Thorin, and how did the orcs, including Azog, know specifically when Thorin had left the Blue Mountains and the Shire?
Also, if Gandalf DOESN’T meet Thrain in Dol Guldur, how does he get the map? If Thrain is, as Thorin suggests, wandering the wilds of Dunland, Gandalf could have met him before the movies and gotten map and key. Gandalf would have been in the right place at the right time. But it’s super weird Gandalf wouldn’t later mention, ‘Hey, I found your Dad, he’s crazypants, here’s his stuff.’
These aren’t random details. There are whole scenes devoted to building these points. Am I missing something?
Edit: It’s possible that Saurman has already turned, likely even, and is watching Thrain at least a year before AEJ. Saruman has crebain in Dunland, as disclosed in the Fellowship movie. If Gandalf found Thrain, got the map and key, and Saurman saw it, Saruman could have reported to Sauron who figured out what was going on, wrote a contract on Thorin, and had Azog in waiting at the beginning of AEJ.
But none of those actions are disclosed, except Gandalf meeting Thrain at some point. Saruman and Sauron would be doing a lot of key stuff off-camera that is addressed but never resolved on-camera.