The narrator of The Raven knows that someone is at his door because he heard a gentle knocking.
This is what the poem says:
...While I nodded, nearly napping, suddenly there came a tapping,
As of some one gently rapping, rapping at my chamber door.
However, when he opened the door, there was no one there. Later, a raven entered his room through the window, and the narrator started talking to the bird, asking it whether he will ever see his loved one again, and the answer was 'Nevermore.'