An essay is nonfiction. That means that the writer of an essay is trying to tell the truth, not merely entertain. A short story isn't an essay because it's fiction. To say that an essay is nonfiction doesn't mean that every word of an essay must be literally true. Hypothetical examples can be an effective way of illustrating a point, as can quotations from fictional works. But such imaginative illustrations should always serve the purpose of clarifying or illustrating a claim that the writer believes to be actually true, in the real world.