Question: Was Sanjaya fighting in the battle of Kurukshetra, or was he with Dhritarashtra in Hastinapura narrating the events?
Sanjaya fought in the battle, and was one of the few to return from the battlefield. He was the last person that Sahadeva was going to kill, but Arjuna stopped him and said, “No. He is our friend. Let him go and report to the old, blind man, Dhritarashtra.” So Sanjaya left the field of battle. On the way he met Duryodhana before reaching Hastinapura.
But there is also another description in the Mahabharata, where Sanjaya is sitting in Hastinapura and speaking to Dhritarashtra while the battle is going on. How is it possible that Sanjaya is fighting on the battlefield of Kurukshetra, and simultaneously speaking to Dhritarashtra in Hastinapura. It was by the mercy of Vyasa that he was able to expand himself into two forms and act in both places simultaneously. In those times it was not such an impossible task, especially for those who were direct disciples of Vyasadeva. The Gita uses the words vyasa-prasadat. By the mercy of Vyasa it was possible.