Peter Ivanovich, like everyone else on such occasions, entered feeling uncertain what he would have to do. All he knew was that at such times it is always safe to cross oneself. But he was not quite sure whether one should make obseisances while doing so. He therefore adopted a middle course. On entering the room he began crossing himself and made a slight movement resembling a bow. At the same time, as far as the motion of his head and arm allowed, he surveyed the room. Two young men – apparently nephews, one of whom was a high-school pupil – were leaving the room, crossing themselves as they did so. An old woman was standing motionless, and a lady with strangely arched eyebrows was saying something to her in a whisper. A vigorous, resolute Church Reader, in a frock-coat, was reading something in a loud voice with an expression that precluded any contradiction. (1.24)
In a religious atmosphere, Peter Ivanovich feels out of place; he doesn't know exactly what to do. For him, religion is just a matter of going through the right motions, and doing what you're supposed to do. Not that the image of religion itself that Tolstoy paints right here is particularly flattering either. In this context, at least, it seems artificial, represented by the loud and imposing Church Reader.
The service began: candles, groans, incense, tears, and sobs. Peter Ivanovich stood looking gloomily down at his feet. He did not look once at the dead man, did not yield to any depressing influence, and was one of the first to leave the room. (1.48)
Just like Peter Ivanovich's gestures earlier, the service itself seems purely artificial. Tolstoy just describes the external trappings of it: the candles, incense, groans, and tears. The description is so short, rushed, and casual that the effect is actually rather funny. Moreover, after all the people we've met – including Ivan's own widow – it's even hard to believe that any of the sobs or groans are sincere. That's just what one is supposed to do at funerals, so people are obliging.
"Well, friend Gerasim," said Peter Ivanovich, so as to say something. "It's a sad affair, isn't it?"
"It's God will. We shall all come to it some day," said Gerasim, displaying his teeth – the even white teeth of a healthy peasant – and, like a man in the thick of urgent work, he briskly opened the front door, called the coachman, helped. (1.49-50)
Just as Gerasim is the only character who has an honest and genuine understanding of death, he's also the only character who seems to have a genuine and sincere belief in God. He accepts death as God's will. With his faith, it's hard for him to believe that death could be such a horrible thing. This is in stark contrast to Peter Ivanovich, who can't bear the thought of death. Gerasim's view also contrasts with the fakeness of the service we've just seen. Tolstoy won't let a description of Gerasim go by without mentioning how physically healthy he is. His physical health mirrors his spiritual health.
"Why hast Thou done all this? Why hast Thou brought me here? Why, why dost Thou torment me so terribly?"
He did not expect an answer and yet wept because there was no answer and could be none. The pain again grew more acute, but he did not stir and did not call. He said to himself: "Go on! Strike me! But what is it for? What have I done to Thee? What is it for?" (9.10-12)
This is the first time Ivan himself makes any serious mention of God. He assumes that God must be punishing him for something, since he's suffering so much. That seems different than what Ivan feels at various moments earlier in the story, when he doesn't seem to have any idea why what's happening to him is actually happening. Where did God come into the picture?
Then he grew quiet and not only ceased weeping but even held his breath and became all attention. It was as though he were listening not to an audible voice but to the voice of his soul, to the current of thoughts arising within him. (9.13)
Ivan's been asking angry questions constantly in the story but he's never really stopped to listen. It seems at first as if he's listening for God, but what he ends up hearing is his own soul. It's the first time Ivan looks inward at his true self, the part of himself that isn't false.
"Live as you lived in the law courts when the usher proclaimed 'The judge is coming!' The judge is coming, the judge!" he repeated to himself. "Here he is, the judge. But I am not guilty!" he exclaimed angrily. "What is it for?" And he ceased crying, but turning his face to the wall continued to ponder on the same question: Why, and for what purpose, is there all this horror? But however much he pondered he found no answer. And whenever the thought occurred to him, as it often did, that it all resulted from his not having lived as he ought to have done, he at once recalled the correctness of his whole life and dismissed so strange an idea. (9.26)
Now Ivan explicitly thinks of God as a judge, and he starts to think of whether his suffering reflects a judgment on him. That could explain its purpose, which is what he hasn't been able to explain since he began to suffer. But that would only make sense if Ivan had done something wrong, and Ivan can't accept that yet.
When the priest came and heard his confession, Ivan Ilych was softened and seemed to feel a relief from his doubts and consequently from his sufferings, and for a moment there came a ray of hope. He again began to think of the vermiform appendix and the possibility of correcting it. He received the sacrament with tears in his eyes. (11.23)
Although Ivan's thoughts have had a bit more of a religious bent at this point, he doesn't ask to see the priest himself; his wife asks for him. What's interesting is that, although the priest seems to help, he doesn't help in the right way. The priest makes Ivan think of himself medically one last time, and not spiritually. The priest has the same effect as a doctor, in other words. What might Tolstoy be suggesting with this implication?
Suddenly some force struck him in the chest and side, making it still harder to breathe, and he fell through the hole and there at the bottom was a light. What had happened to him was like the sensation one sometimes experiences in a railway carriage when one thinks one is going backwards while one is really going forwards and suddenly becomes aware of the real direction.
Just what is going on here? Is Ivan Ilych having the realization himself, or is God acting on him? Who or what is responsible for Ivan's transformative moment?
"Yes, I am making them wretched," he thought. "They are sorry, but it will be better for them when I die." He wished to say this but had not the strength to utter it. "Besides, why speak? I must act," he thought. with a look at his wife he indicated his son and said: "Take him away...sorry for him...sorry for you too...." He tried to add, "Forgive me," but said "Forego" and waved his hand, knowing that He whose understanding mattered would understand. (12.8)
This is the only explicit reference to God from the moment of Ivan's realization onwards. We really don't have any direct indication of what role God has played. Has God been present to Ivan this whole time, or is Ivan expecting to enter into God's presence after he dies?