How did John know what Jesus prayed in John 17 , if Jesus prayed alone?
You raise an excellent question. It is similar to the question, How do we know what the temptation of Jesus by Satan looked like? I think we have essentially four options in questions like this: (1) assume that it is wholly fictitious;
(2) assume that someone besides Jesus told the disciple(s) about the incident;
(3) assume that the Holy Spirit told the disciples later; or
(4) assume that Jesus told the disciple(s) about the incident.
As for view 1, the general reliability of the Gospels on other fronts makes this one the most unlikely. Regarding view 2, this is certainly not the case in the temptation of Jesus, and is most likely not the case in John 17, either. The fact that there can be at least one incident in the life of Jesus that no one else witnessed, yet was recorded in the Gospels, tells us that view 2 is not likely. View 3 suffers from the modus operandi that is seen everywhere else in the Gospels: the evangelists gathered their material from eyewitnesses, human eyewitnesses, to the events in question. Further, once one opens the door on this option, where does it stop? Should we say that the Holy Spirit added to the words that the historical Jesus uttered, or that what one evangelist wrote about, even though allegedly witnessed by several people, was actually only told him by the Holy Spirit? That is not likely, and it certainly is not in keeping with the tenor and explicit testimony of the Gospels elsewhere. When we come to view 4, it certainly raises some interesting questions, such as "How did the disciples find out? Did they sit down and interrogate Jesus about these events? Did they function as reporters?" What is interesting to me is that not once do we read anywhere in the Gospels, as far as I am aware, in which an evangelist says, "I got this story from so and so." That is, nowhere in the Gospels does the evangelist tell us that he used a source for a particular story. Yet Luke's prologue and John's epilogue tell us, in broad strokes, that they did this very thing. So it seems to me that the M.O. of the evangelists is not to tell who their sources were, but to indicate that they did use human, eyewitness sources for their narratives and, on many occasions, were the eyewitnesses themselves. All it takes is for us to use a slightly sanctified imagination to envision the disciples sitting around the fire with Jesus, asking him all sorts of questions. We know that they did this with prophecy (see Matt 24); so why couldn't they do this with history, too?
(2) assume that someone besides Jesus told the disciple(s) about the incident;
(3) assume that the Holy Spirit told the disciples later; or
(4) assume that Jesus told the disciple(s) about the incident.
Articles related to Matthew: