In "The Raven," by Edgar Allan Poe, is the raven really talking to the narrator or is the narrator just imagining the raven talking to him?
The short answer is that we can't know for sure. The narrator's first thought about the raven's speech seems entirely plausible: he assumes that the raven's one word "is its only stock and store / Caught from some unhappy master" who clearly had a difficult life and, therefore, spoke the word quite often (lines 62-63). The narrator believes that the bird learned the word "nevermore" from hearing his master say it again and again. This could be true.
It could also be true that the raven isn't actually speaking at all, that its cawing croaks simply sound a lot like the word "nevermore" to the grief-stricken narrator. He is mourning the loss of the woman he loved, he's gotten little to no sleep, and it is midnight. The mood is certainly spooky, especially after he's opened the door to find no one there, and so maybe the raven's speech is the result of the narrator's overly active imagination only.
Like any bird that "talks" or "speaks," the raven is merely mimicking a word or sound that it has heard before. It does not carry on a conversation--"nevermore" is the only word it ever utters (at least that is what the narrator thinks he hears)--and it doesn't really seem to pay much attention to the narrator as it perches at a safe distance on the head of a bust. When the narrator discovers that the bird can only speak one word, he nonetheless continues to ask questions that can still be answered sensibly with the answer "nevermore." The narrator, who at the beginning of the poem is already devastated by the "loss of Lenore," is on the verge of losing his sanity at the end as he asks the bird to predict his future with the "lost Lenore."