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.