The relationship of the living and the dead is an oft debated topic by the sages. Judaism firmly believes that, post mortem, a person's neshama (soul) goes to an afterworld known as Olam Habah, the world to come. But do the dead play any role in Olam Hazeh, this world, when they are gone? Many Talmudic sages were sure that the dead visit this world, especially cemeteries.
Rabbi Hiyya and Rabbi Jonathan were walking in a cemetery and the blue fringe (tzitzit) of Rabbi Jonathan trailed on the ground. Said Rabbi Hiyya to him: “Lift it up, so that they [the dead] should not say: ‘Tomorrow they are coming to join us [as they too shall die] and now they are insulting us [by showing off their ritual garments]!'” Rabbi Jonathan replied: “Do they know so much? Is it not written, ‘But the dead know not anything?'” (Berachot 18a). A long argument ensues in which different Biblical verses are cited. In the end, however, Rabbi Jonathan agrees with Rabbi Hiyya that the dead do visit this world.
This is supported by an earlier statement (Berachot 18a):
“It has been taught: ‘A man should not walk in a cemetery with tefillin on his head or a Torah on his arm, and recite the Shema,' and if he does so, he comes under the heading of ‘He that mocks the poor blasphemes his Maker' (Proverbs 17:5)." A person studying Torah or fulfilling mitzvot in a cemetery is mocking the dead who can no longer perform those mitzvot.
Whether one believes that the dead are watching and interacting with this world or not, halacha (Jewish law) puts great stock in respecting the dead, if only to teach the living to be more sensitive to the living people around them.