Ah, Star Wars characters and their loveable droids. Luke and R2-D2, Leia and C-3PO, Rey and BB-8.. So it's fair to say that, even though we had plenty of the adorable BB-8 in [Star Wars: Episode VII — The Force Awakens](tag:711158), the story behind the whereabouts of R2-D2 during the events of the film could've used some more padding out. As ScreenRant ask: "Why Does R2-D2 Suddenly Wake Up? Why Did He Have the Map?"
The Jedi Temple
To answer this question it helps to look first to the whereabouts of Luke Skywalker (Mark Hamill) during the events of the film.
His disappearing act has been criticised as selfish and inconsistent with his previously established character development, but if you consider the importance of the Jedi Temple (something which is sure to be central to the narrative of [Star Wars: Episode VIII](tag:711868)) then it starts to make sense.
As the last remaining Jedi he had to go to guard something of great importance; remember that the map that Rey (Daisy Ridley) follows to find him isn't actually a map to Luke, it's a map to the Temple itself. We assume that Kylo Ren (Adam Driver) is pursuing Luke to wipe out the last Jedi, but it's more than likely that what he's actually looking for is the Temple itself.
Okay, So Why Did R2 Have The Map?
It seems a bit silly doesn't it? Leaving a map behind to lead anyone who can find it to the secret he's trying to guard. Well as it turns out we do have an official answer for this, though sadly it's not the most satisfying of explanations.
According to Star Wars 7 screenwriter Michael Arndt the little blue and silver droid didn't actually get the map to the Temple from Luke; rather he got it from "plugging into the information base of the Death Star".
Director J. J. Abrams has elaborated on this explaining that - though he's aware it's not the most satisfying of reintroductions for the iconic droid - R2's awakening had to happen at that point both to soften the blow suffered by the loss of Han Solo (Harrison Ford) and to move the plot along to a satisfying conclusion.
"The idea was that in that scene where R2 plugged in, he downloaded the archives of the Empire, which was referenced by Kylo Ren. BB-8 comes up and says something to him, which is basically, ‘I’ve got this piece of a map, do you happen to have the rest?’ The idea was, R2 who has been all over the galaxy, is still in his coma, but he hears this. And it triggers something that would ultimately wake him up."
Okay, that kinda makes sense. But then - as ScreenRant point out - why have the two droids never met before? C-3PO clearly knows BB-8, and the little orange droid has been kicking around the Resistance Base with his piece of the map for a while at this point. Once he's returned with the map he goes to nudge R2-D2, but C-3PO tells him not to bother. He does eventually wake up after BB-8 tells him he has the map but why is it only after the climactic battle, right as our heroes return from Starkiller Base, that this happens?
Okay, maybe this is just a deus ex machina style slip in the storytelling fabric. But there is an explanation that patches this hole without having to make any great leaps. And like a lot of things in The Force Awakens, the answer is Rey.
Rey's Force Awakens
So the battle at Starkiller base is a big deal, not just because the Resistance ends up victorious but also because the death of Han Solo and the subsequent battle with Kylo Ren triggers the titular 'awakening' within Rey, as she fully realises her power as a Force Sensitive handling a lightsaber for the first time.
It's entirely possible that - rather than just BB-8 showing up with the map - R2-D2's awakening is also linked to Rey's awakening. If we accept that Luke left not out of disgrace or cowardice but rather to protect the Temple whilst awaiting the resurgence of a new Force Sensitive then it makes perfect sense that it's actually Rey (or a combination of Rey and BB-8) that causes R2 to awake.
Of course this might suggest that R2-D2 is a Force Sensitive himself (well c'mon, it's better than Jar Jar being a Sith Lord), but again it's been posited that Luke could've awoken R2-D2 remotely when he felt that iconic "disturbance in the force" - Rey's awakening.
This would also clarify a reason for Luke to leave a map to the Temple's location behind - it was so the new generation of Jedi could find their way to him if and when they emerged. Furthermore - why would Luke leave R2 behind in the first place if not to wait for something, or someone?
It might not be the official answer, but it does solve the issue of why R2-D2 awoke when he did without falling back on coincidence for convenience's sake. Likely we won't get a proper explanation on screen (unless they address this in Star Wars 8 when Mark Hamill finally speaks), so for now I guess we just have Abrams' and Arndt's explanation to go by - even if it doesn't quite fill all those little plot holes.