Hallucination is a mechanic found in the Amnesia series.
During various points of the game, Daniel can hallucinate a number of sounds, visions, and even enemies. These hallucinations may or may not be caused by Daniel's current sanity, depending on the specific case.
In Amnesia: A Machine For Pigs, hallucination returns, but as a scripted event. Oswald may hallucinate as he is seeing his children running away from him or entering a non-existent room. Sometimes, he may pass out after that and wake up in a completely different room. This is caused by Mandus' unstable psyche.
It is left ambiguous whether certain events witnessed by the player are real or not, such as the drowning man in the Cistern and when the prisoners are being beaten by Brutes in the Prison. However, it is mentioned in the Developer Commentary for the prison that the theme of the level is a shift from past events to the present, and also directly mentions the sound of the man being beaten, which strongly implies that this is actually happening as you move through the level.
On occasion, Daniel can hallucinate an entire enemy, as is the case in the Archives, Prison and Sewer. In the Archives, Daniel will see a Servant Grunt following him when he inspects a caved-in passage; In the Prison he might (5% of probability) see a Servant Grunt flashing along the corridor at the southern block, and in the Sewer, he will witness a Brute walking through the room ahead. All three will disappear if they come too close to Daniel.
Daniel may hear the sounds and sometimes even see the splashes of a Kaernk in both the Cistern and Sewer even when the creature is not on the map, though it is questionable whether or not this is a hallucination, as the Kaernks are possibly an ethereal being. If Daniel's sanity is at the stage of "...", he may actually "see" a Kaernk splash up to him and follow him, however it will not attack him.
Enemy hallucinations will still produce the same music as real Gatherers as well as the Terror Meter. A Gatherer will "poof" to dust, when he comes close to the player. A deep sound effect can be heard as the enemy fades. Kaernks don't have any particular effects or sounds when the hallucination fades. In the level editor, every entity can be marked as a sanity-caused object, but only enemies can be marked as hallucinations. While the most hallucinations are caused by a low sanity value, the Servant Grunts in the Archives and the Brute in the Prison appear always when the player reaches a script area.