After the battle of the Pellenor Fields in The Lord of the Rings: The Return of the King, Pippin searched for Merry on the battlefield. The last time they spoke, Merry was still in Rohan. How, aside from divine intuition, did Pippin know that Merry was with the army? Is there anything in the movies or the book that would explain this? Éowyn, the only person who knew that Merry wasn't left at Dwimorberg, was badly injured.
In the book, they meet inside the gates of the City. Pippin says that Gandalf send him to look for Merry. From beginning of the chapter "The Houses of Healing":
Slowly the lights of the torches in front of him flickered and went out, and he was walking in a darkness; and he thought: ‘This is a tunnel leading to a tomb; there we shall stay for ever.’ But suddenly into his dream there fell a living voice.
‘Well, Merry! Thank goodness I have found you!’
He looked up and the mist before his eyes cleared a little. There was Pippin! They were face to face in a narrow lane, and but for themselves it was empty. He rubbed his eyes.
‘Where is the king?’ he said. ‘And Éowyn?’ Then he stumbled and sat down on a doorstep and began to weep again.
‘They have gone up into the Citadel,’ said Pippin. ‘I think you must have fallen asleep on your feet and taken the wrong turning. When we found that you were not with them, Gandalf sent me to look for you. Poor old Merry! How glad I am to see you again! But you are worn out, and I won’t bother you with any talk. But tell me, are you hurt, or wounded?’
In the movie, able bodied survivors are looking for friends and family who also fought and also injured survivors. While searching, Pippin comes across Merry's elven cloak. Pippin then begins his search specifically for Merry and does not give up until he is found.