Our Gemara on amud aleph discusses the idea that a repentant thief may be disturbed that his reputation as a thief would be discovered after his death. This implies that dead people have an awareness of the goings on in the physical world. However this is subject to debate in Gemara Berachos (18b) with a number of incidents with various sagely and pious persons, the dead and the living.
In one case, a man receives messages from a deceased person regarding the future growing season. In another, the location of buried treasure is revealed. And in yet another scenario, the sons of the deceased Rabbi Chiyya wonder if he knows of their plight. For each scenario, a qualifying distinction is made. Tosafos Sotah (34b, “Avosay”) understands that the conclusion of the discussion in Gemara Berachos is that ordinarily the dead do not have knowledge of the goings on in this world.
However, Tosafos must explain the valid custom of praying by the graves of the righteous that is discussed in Sotah (ibid) and Ta’anis (16a). Tosafos says that the act of prayer itself arouses a heavenly network of sorts, and the dead person becomes aware of the need to pray on behalf of the supplicant. As far as our Gemara goes, Tosafos does speak to it. But I presume Tosafos holds that this person’s belief that he will know if he is called a thief after his death might merely be a superstition, and not represent valid theology. After all, the thief is not likely to be a learned man.
The Ran (Derashos Haran 8) offers a different reason for the value of prayer by the graveside of a holy person that is not dependent on the actual awareness of the deceased. He says that the presence of anything holy, including the body of a holy person, activates and inspires spiritual channels. He sees it as analogous to the holiness of the Temple site.
What the dead know about us is less important than what we know about the dead. We still have life to live and can draw strength from their memories to guide us.