In the first paragraph of the story Montresor specifies two things necessary for a successful revenge.
I must not only punish but punish with impunity. A wrong is unredressed when retribution overtakes its redresser. It is equally unredressed when the avenger fails to make himself felt as such to him who has done the wrong.
He was in no hurry to achieve his revenge. He wanted to eliminate any possibility of risk. So he says:
It must be understood that neither by word nor deed had I given Fortunato cause to doubt my good will. I continued, as was my wont to smile in his face, and he did not perceive that my smile now was at the thought of his immolation.
Not only does Fortunato have no cause to doubt Montresor's good will, but all who knew the two men considered them the best of friends. Montresor had obviously conditioned himself to think of Fortunato as his good friend. He had gotten so used to doing this that he speaks of him as his friend, his good friend, and his poor friend throughout the story. He must have been continually speaking of "My friend Fortunato" to other people, and he must have intended to show extreme concern when his friend disappeared. Here are examples of how he addresses him when he encounters him celebrating on the street.
“My dear Fortunato, you are luckily met."
“My friend, no; I will not impose upon your good nature."
“My friend, no. It is not the engagement, but the severe cold with which I perceive you are afflicted."
Montresor expects to be able to "punish with impunity" because no one would ever suspect such a good friend of foul play. He will also be sure "to make himself felt as such to him who has done the wrong." Throughout the story Fortunato never addresses Montresor by name. But when he realizes that he is trapped and doomed, Fortunato cries, "For the love of God, Montresor!" This satisfies Montresor's second condition for a successful revenge. Fortunato was drunk, but he has sobered up quickly as he has realized his terrible predicament. In calling Montresor by name, he shows he is fully aware of the "avenger's" identity. He also probably understands that Montresor hates him and has been deceiving him for years regarding their supposed friendship. Everybody who knows them will always think of them as very good friends, but Fortunato will die knowing the real truth.
Montresor is capable of having two different identities. There is the obsequious man who puts up with all of Fortunato's injuries because he is apparently too insensitive to understand he is being injured. And there is the shrewd, vindictive man who is unknown to everybody until he reveals himself to Fortunato and then reveals himself to the reader fifty years later. The story begins with Montresor specifying that he must punish with impunity and must make himself known as the punisher to his victim. It ends with both of these requirements satisfied, which makes it a perfect revenge and a perfect crime.
Montresor had a very difficult problem. He had to lure Fortunato off the streets through a crowd of revelers without being recognized as his companion. Then he had to be sure that no one would ever suspect him of foul play after Fortunato had mysteriously disappeared. That is what the whole story is about. Montresor shows that he has been completely successful in achieving satisfaction and closure with impunity when he ends his narrative with these words.
Against the new masonry I re-erected the old rampart of bones. For the half of a century no mortal has disturbed them. In pace requiescat!