The Death of Ivan Ilyich was published in 1886; it is one of Tolstoy's later works and is widely considered a masterpiece of the short story form.
Ten years prior, in the late 1870s, Tolstoy underwent what he called a "conversion" - from the faith-driven religiosity of the Russian Orthodox Church to a more rational, moralistic, egalitarian spirituality. In his 1879 essay A Confession, he posed a question that would drive his writing for the rest of his life: "Is there a meaning in my life that will not be annihilated by the death that inevitably awaits me?" (It is worth noting that A Confession was censored by the Russian authorities, though it became popular in underground circles...