The first almost-death occurrence is when he stumbles in his dark prison, and comes right up against the vast pit that is in the middle. He is lucky in this; he was wandering around blindly and happened to trip on his robe and fall, discovering the pit before he wandered into it and died. If the fall into the pit didn't kill him, the rats, cold and wet down there would have eventually led him to a nasty death. So fortunately, he discovers that evil before he falls in. The discovery of the pit itself lets the reader know that his captors plan on not just outright killing him, but on torturing him; this is psychological tortuous in and of itself. He knows he is doomed, but doesn't know how they will go about it--however, he suspects that it won't be fun.
His captors, once they realize the pit won't work because it has been discovered, move on the plan B: the pendulum of death. They tie him to a board and slowly lower a swinging pendulum with a scythe, or long, curved blade, attached at the end. The narrator realizes that the blade will slowly, oh so slowly, slice through his chest. This tortures hiim psychologically--the entire way down, he has to sit there and imagine the coming pain. However, he uses his brains, rubs meat on the ropes binding his hands, and lets the rats eat through the ropes so that he can get out and escape.
Thwarted twice, the captors then set fire to his chamber; he describes, in a rather confusing scene, how he imagines the walls glowing red, and almost melting. He realizes that he will suffocate and burn to death--he is starting to panic. The psychological knowledge of that coming pain freaks him out. Fortunately, he is resuced at the last minute by the French.
I hope that those thoughts helped a bit; good luck!