If there's one constant in The Death of Ivan Ilych, you might say it's suffering. When Ivan Ilych falls ill with a strange disease, his body slowly starts going to pieces and physical pain becomes a constant in his once-pleasant life. Tolstoy uses Ivan's drawn-out death to meditate on just how many dimensions suffering has beyond the physical. Ivan suffers from fear, hopelessness, loneliness, loss of dignity, and a sense of meaninglessness, all of which torment him just as much as his pain. Suffering doesn't have a bad rap entirely; it may also be suffering which leads to his final redemption.
Ivan's suffering transforms his character by making it impossible for him to uphold pleasantness as his standard of happiness.
Ivan's suffering does have a purpose, in that it forces him to confront the emptiness of his former life and leads him into a new, spiritual life.