The overarching literary device Dahl uses in the story is pun. A pun is a word or phrases that has two or more applicable meanings at the same time.
The title—and the most important act in the story—is a triple pun. "Lamb to the slaughter" is a phrase that means an innocent is being sacrificed for the needs of another. In this case, Mary is that lamb. Heavily pregnant and a devoted wife, her needs are being sacrificed to her husband's desire for a divorce. Mary is the one who is going to have to suffer because of his decision, and she has done nothing (as far as we know) to deserve this fate.
Yet the title of the story, lamb to the slaughter, is also literal. A leg of lamb is literally the weapon Mary uses to slaughter her husband. Much of the story turns on the police being unable to imagine this as they calmly eat the murder weapon she has cooked.
Finally, Mary is not only the lamb taken to be slaughtered, she is the lamb or innocent who goes "to the slaughter" of her husband.
Dahl also uses imagery to paint Mary with a Madonna-like glow, which builds reader sympathy for her. Further, he tells the story from her point-of-view, which makes her the most relatable character. Therefore, when she whacks her husband with the frozen leg of lamb, we are more likely to excuse what she has done than side with her murdered spouse.
The first technique Dahl employs is contrast. He juxtaposes Mary Maloney's actions and words with those of her husband. The contrast is introduced when Mary pours him a strong drink and a weak one for her. This in itself symbolizes the difference at this point between the two. When Mary, obviously a doting and caring spouse, speaks to her husband, she uses a caring tone. She is practically servile in her approach and is insistent that she wants to do good. Her husband, on the other hand, displays a brusque, off-hand manner marked by short, terse expressions. It is evident that he has something on his mind and one expects that he is about to tell his docile, loving wife exactly what it is.
In this regard, Dahl also foreshadows what is to come. It is easy to ascertain from Patrick Maloney's manner that he has nothing good to share with Mary. Dahl creates this expectation and we are not surprised when he tells Mary that he is going to leave her.
There is irony in what Patrick does since Dahl has painted his wife as an innocent and harmless individual who needs protection. This aspect is emphasized by the fact that she is pregnant with his child. She is in an extremely vulnerable position and Patrick should, therefore, be more supportive of her. This is not only true because he is a husband, soon-to-be-father, but also because he is a detective. This means that he is there for the protection of the weak and should be selfless. Patrick is, however, uncaring and thinks only of himself.
The irony is extended throughout the story. Mary commits a most heinous criminal act. She clobbers her husband to death and then deliberately proceeds to cover up her crime. Her actions speak of one who is cold-hearted and vengeful, not one who would exude a look of peace and calm as described earlier:
...she was curiously peaceful. Her mouth and her eyes, with their new calm look, seemed larger and darker than before.
Mary convincingly plays a charade and fools everyone into believing her. The visiting detectives and other officers literally eat out of her hand, so much so that she lets them ingest the murder weapon. In this instance, Dahl uses both verbal and situational irony as well as sardonic humor to make the point that appearance and reality are not always one and the same thing; we may be easily deceived.
In "Lamb to the Slaughter," Dahl uses a number of literary devices. For example, he uses foreshadowing to build suspense as the story progresses.
And as he spoke, he did an unusual thing. He lifted his glass and drank it down in one swallow although there was still half of it left. He got up and went slowly to get himself another drink.
This change in Patrick's usual behavior suggests something extraordinary is about to happen. As such, Dahl not only hints at Patrick's announcement of his decision to divorce Mary, but also at her violent reaction to the news.
In addition, Dahl uses irony towards the end of the story when the police are investigating Patrick's death. They eat the lamb, for instance, as they muse over the whereabouts of the weapon:
"Personally, I think the weapon is somewhere near the house."
"It's probably right under our noses. What do you think, Jack?"
The police have no idea that they are, in fact, eating the murder weapon. This use of irony adds an element of dark humor to the story which is not wasted on Mary, who is described as "laughing" in another room.
For more information on Dahl's use of literary devices, please see the reference link provided.