In The Name of Allaah, The Most Merciful, The Bestower of Mercy.
Allaah [The Exalted] said:
إِنَّا نَحۡنُ نُحۡىِ ٱلۡمَوۡتَىٰ وَنَڪۡتُبُ مَا قَدَّمُواْ وَءَاثَـٰرَهُمۡۚ وَكُلَّ شَىۡءٍ أَحۡصَيۡنَـٰهُ فِىٓ إِمَامٍ۬ مُّبِينٍ۬
Verily, We give life to the dead, and We record that which they send before (them), and their traces, and that which they leave behind], and all things We have recorded with numbers (as a record) in a Clear Book. [Surah Yaaseen. Aayah 12]
[إِنَّا نَحۡنُ نُحۡىِ ٱلۡمَوۡتَىٰ – Verily, We give life to the dead]- Meaning, We’ll resurrect them after their death to recompense them for their deeds (1). [وَنَڪۡتُبُ مَا قَدَّمُواْ – and We record that which they send before (them)] – Meaning, good and evil, the deeds they did during their lifetime (2).
[وَءَاثَـٰرَهُمۡۚ – and their traces]. Imaam Ibnul Qayyim [rahimahullaah] said: That which they initiated of good or evil and thus they were followed by others after their death. (3)
Imaam Al-Aloosee [rahimahullaah] said: That which they left behind of good deeds, such as the knowledge they taught people, books they wrote, land they gave as endowment or a building they built in the path of Allaah and other good deeds; or sins, such as establishment of laws [legislation, rules, regulations etc] that are tantamount to oppression and transgression, or setting up principles amongst the people that are tantamount to evil and corruption, and the evil Funoon [i.e. haraam professions, crafts etc] which they initiated and were revived after them by the corrupt people. 
Imaam As-Sadi [rahimahullaah] said: It is the good and evil outcomes about which they were the cause of its occurrence during their life time and after their death, and those deeds that emanated from their statements, deeds and circumstances. Every good performed by one of the people due to the knowledge of the servant, his teaching and advice, or through enjoying good and forbidding evil, or knowledge he transmitted to the learners, or in a book which is benefitted from during his life and after his death, or a good deed, such as Salaah, Zakaat, Sadaqah or kindness based on which he was followed, or built a masjid or a place which the people benefit from and what is similar, it will be from the good outcomes that are written for him, and likewise are the evil outcomes. The Prophet [sallal laahu alayhi wasallam] said, “Whoever starts a good thing [i.e. something other than bidah and sin] and is followed by others, he will have his own reward and a reward equal to that of those who follow him, without it detracting from their reward in any way. Whoever starts a bad thing [i.e. a bidah, sin or something that opposes Islaam] and is followed by others, will bear the burden of his own sin and a burden equal to that of those who follow him, without it detracting from their burden in any way”. [Reported by al-Tirmidhi, no. 2675]
This subject matter makes clear to you the lofty station of calling to the path of Allaah, guidance to His path through every means and path that leads to it; and the lowly status of the caller to evil and a leader in it, and that he is the most degraded human being, one who has committed the severest crime and the greatest sin. 
[Refs. 1 & 2: An Excerpt from Tafseer As-Sadi. Daar Ibn Hazm. 1st edition 1424AH (2003). Slightly paraphrased]
[Ref 3. An Excerpt from Badaa’i at-Tafseer Al-Jaami Limaa Fassarahu Al-Imaam Ibnul Qayyim 2/358. Daar Ibn Al-Jawziy 1431AH. Slightly paraphrased]
[Ref 4: An Excerpt from Roohul Ma’aanee 12/325. Daar Al-Fikr. 1417AH (1997). Slightly paraphrased]
[Ref 5: An Excerpt from Tafseer As-Sadi. Daar Ibn Hazm. 1st Edition 1424AH (2003). Slighrly paraphrased]