To understand the nature and reason for Macbeth's visions and hallucinations, and how they determine his character, one has to understand the context in which they occur.
It is clear that even though Macbeth has concluded that he has to kill Duncan to become King of Scotland, he does not relish the task. He is overwhelmed by the thought of having to commit such a dreadful act and in a lengthy monologue he reasons that his purpose is too feeble, saying:
I have no spur
To prick the sides of my intent, but only
Vaulting ambition, which o'erleaps itself
And falls on the other.
He has reasoned that there are many reasons why killing Duncan would not be wise. In this state of mind, he tells Lady Macbeth that:
We will proceed no further in this business
He is, however, persuaded by her insistence, her criticism of his manhood and her promise to be cold towards him to continue with the dastardly deed.
It is in this context that Macbeth, when the time nears to commit the foul deed, hallucinates and sees a dagger appear before him. He is under intense pressure, for he has made a vow to his wife. He is anxious, afraid and overwhelmed by the thought of committing such a horrific crime. So overcome is he by all these factors that he imagines seeing the dagger, which is a representation of the evil he is about to commit. Macbeth realises this and questions this figment of his imagination:
art thou but
A dagger of the mind, a false creation,
Proceeding from the heat-oppressed brain?
The second time Macbeth is occasioned by an unwelcome vision is after he has had Banquo murdered. Once again, he has committed an utterly reprehensible act: the assassination of a best friend, confidante and ally. Banquo's ghost appears to him at the banquet table, sitting in his place. Macbeth addresses the spirit he imagines seeing:
Thou canst not say I did it: never shake
Thy gory locks at me.
Macbeth has turned pale with fear and his wife informs the gathering that he is having a fit, an illness that he has had since childhood. Macbeth, however, is horrified and sees the vision as '...that which might appal the devil'. When the ghost reappears, Macbeth is once again overcome with fear and orders the ghost to leave. Once the ghost vanishes he declares,
'Why, so: being gone,
I am a man again'.
It is clear at this point that Macbeth has been, and is, possessed by paranoia - he has begun seeing danger everywhere - there is considerable risk, even from the dead. In this state, he has begun to get rid of those he deems a threat, and no one is spared. Macbeth has now become rooted so much in his own evil that he cannot stop himself.
Finally, Macbeth undertakes a visit to the witches to seek their assurances that he is safe and protected by their charm. During this visit, he sees several visions, each with its own message. The first is the apparition of an armed head which informs him:
... beware Macduff;
Beware the thane of Fife.
The second apparition says the following:
Be bloody, bold, and resolute; laugh to scorn
The power of man, for none of woman born
Shall harm Macbeth.
... Macbeth shall never vanquish'd be until
Great Birnam wood to high Dunsinane hill
Shall come against him.
The fourth vision is one of Banquo, showing his hereditary line which follows into eternity. Banquo appears at the end. Macbeth is overwhelmed and utters the following:
Horrible sight! Now, I see, 'tis true;
For the blood-bolter'd Banquo smiles upon me,
And points at them for his.
Macbeth has reached a point where he feels so vulnerable that he needs guarantees from the evil sisters that he is safe. Since he mistrusts everyone, he ironically turns to the devil's disciples for comfort. Macbeth has lost all reason and is unable to see through the witches' paradoxes and equivocation. When he is later faced with the reality of their ambiguity, it is too late. He then only realises their deception and finally acknowledges their devastating and diabolical duplicity.