There are a few different ways it may be necessary to quote dialogue from a novel or other literary work in an essay.
1) If you are using any narrative or stage directions in your quote to prove your point along with your dialogue, the narrative will be surrounded by double quotation marks and the dialogue will be surrounded by single quotation marks.
For example: When Mr. Bennet spelled out the necessities of formal introduction, "The girls stared at their father. Mrs. Bennet said only, 'Nonsense, nonsense!'" (Austen, Pride and Prejudice, Pemberly.com). Note, that because the exclamation mark is a part of the dialogue, it goes inside to the single quotation mark. Also note that the quote is ended with a double quotation mark and there is no space between single quotation mark and the double.
2) If what you are quoting in your essay to prove your point is a line of dialogue by itself, then you can treat the dialogue like any other text quoted and only surround it with double quotation marks.
For example: Mrs. Bennet demonstrates her designs on Mr. Bingley when she declares, "Oh! single, my dear, to be sure! A single man of large fortune; four or five thousand a year. What a fine thing for our girls!" (Austen, Pride and Prejudice, Pemberly.com).
3) If to prove your point in your essay you want to quote a whole dialogue exchange, you can treat it as a block quote. For a block quote, you leave off the quotation marks, indent every line of the paragraph so that it stands alone in your essay as one single block, and add the reference after the period. For example:
In the novel Pride and Prejudice, the early exchange between Mr. and Mrs. Bennet demonstrates just how silly Mrs. Bennet is and how Mr. Bennet teases her:
What is his name?
Is her married or single?
Oh! single, my dear, to be sure! A single man of large fortune; four or five thousand a year. What a fine thing for our girls!
How so? how can it affect them?
My dear Mr. Bennet...how can you be so tiresome! You must know that I am thinking of his marrying one of them. (Austen, Pride and Prejudice, Pemberly.com)
Note, that in the third line I used an ellipse to cover up some narrative that, if left in the quote, would have made the punctuation more complex and awkward.
4) Finally, if you are quoting dialogue that is more than three lines long and from the same speaker, you would also use a block quotation.
“There were two things about this particular book (The Golden Book of Fairy Tales) that made it vital to the child I was. First, it contained a remarkable number of stories about courageous, active girls; and second, it portrayed the various evils they faced in unflinching terms. Just below their diamond surface, these were stories of great brutality and anguish, many of which had never been originally intended for children at all. (Although Ponsot included tales from the Brothers Grimm and Andersen, the majority of her selections were drawn from the French contes de fées tradition — stories created as part of the vogue for fairy tales in seventeenth century Paris, recounted in literary salons and published for adult readers.)
I hungered for a narrative with which to make some sense of my life, but in schoolbooks and on television all I could find was the sugar water of Dick and Jane, Leave it to Beaver and the happy, wholesome Brady Bunch. Mine was not a Brady Bunch family; it was troubled, fractured, persistently violent, and I needed the stronger meat of wolves and witches, poisons and peril. In fairy tales, I had found a mirror held up to the world I knew — where adults were dangerous creatures, and Good and Evil were not abstract concepts. (…) There were in those days no shelves full of “self–help” books for people with pasts like mine. In retrospect, I’m glad it was myth and folklore I turned to instead. Too many books portray child abuse as though it’s an illness from which one must heal, like cancer . . .or malaria . . .or perhaps a broken leg. Eventually, this kind of book promises, the leg will be strong enough to use, despite a limp betraying deeper wounds that might never mend. Through fairy tales, however, I understood my past in different terms: not as an illness or weakness, but as a hero narrative. It was a story, my story, beginning with birth and ending only with death. Difficult challenges and trials, even those that come at a tender young age, can make us wiser, stronger, and braver; they can serve to transform us, rather than sending us limping into the future.”
― Terri Windling, Mirror, Mirror on the Wall: Women Writers Explore Their Favorite Fairy Tales