My theory is that while training Sasuke, Orochimaru would tell him stories of the toad that could predict the future at the training place. We all know how Orochimaru likes to conduct research and that is one of tw to ways that he probably knows of the toad. The other way is that maybe there was a type of snake or animal that had some sort of other worldly knowledge where went to try and learn a type of sage mode that told him of the toad. He probably knows that Jiraya was keeping tabs on him. Im prettysure that he also knows that Naruto has toad sage mode. He probably heard it come out of Kabuto's mouth while being inside of Anko. He should also know of Naruto's BM. The databooks state that Jiraya was stronger than Orochimaru. From there background you can tell that it wasn't like this in the past. Oro was praised as being a genius as a kid. He then noticed that the pervy sage was getting, as Sasuke noticed of Naruto, stronger. He then goes on to surpass Oro and Oro notices. Orochimaru then starts to conduct research on how it became this way and finds out of Jmans sage mode and tries to obtain one of his own but fails. This is where Sasuke comes in. He learns of Naruto's new powerups and acknowledeges Naruto as being a threat. He probably then remember Naruto saying that they would both die if they were to fight. He would proceed to the training place to ask the toad questions of his fate as an uchiha and of the proficy. After, that he probably meets with Obito if he hasn't already used Rinne tensi to rivive Madara or just seal Madara himself. There is a legit possibility that Obito might betray Madara. You can tell through their dialouge and the way Obito uses blackmail and makes Madara seem as a kid for wanting to exploit the juubi's power.