As much as I know, did a quick speed-skim, Artoo stays with the ship when Anakin lands to go take care of the Sepratists, then R2 is rolling up beside Obi-Wan to leave after Anakin's been all chopped up. Now, Padme was in apparent critical condition at the time and I think R2-D2 is technically owned by her (if Anakin can't have possessions, but Artoo was with Anakin on all those clone wars missions so I think if anyone owns Artoo it's Anakin and she probably gave R2 to him as a gift anyway) so maybe he went to his owner, which would be Padme. Also C-3PO was there so R2-D2 had to go find his buddy. Or maybe when Obi-Wan found him (or Artoo found Obi-Wan) he filled him in quickly on the details. Or maybe Obi-Wan just nodded at him. Or maybe Artoo followed Obi-Wan and Kenobi didn't even notice since he was probably understandably distracted. Or maybe R2-D2 kinda saw what Anakin did. But Anakin told him to stay with the ship! And Artoo seems like the loyal sort. Loyal enough to go find his "Master". Or, hell, maybe on the ride to Mustafar Anakin spilled his guts about all the evil doings he had been up to and R2-D2 was all like, "Yo, this boy be bugging, I'm gonna bounce!" or something. Those are pretty much all of the options I can come up with, although maybe there are a few more, but maybe the truth is in there somewhere. PS- I've had a few beers to come to this thought process. Gotta watch more Dexter. brb.