 Pinhead is an entity that appears in your head when you fall asleep on an odd, numbered level in the back rooms if you're sleeping on the floor. When he appears in your head, he will then transport your consciousness to a live view of reality, the real world. And you will be stuck in this real world view until you can manage to fall asleep in the dream. It's kind of like a paradox. You have to fall asleep while you're already asleep. Pinhead's entire goal is to keep you dreaming for so long that your real body starts to get malnourished and underfed, so then you'll just start withering away. And when this happens to his liking, he'll teleport out of the dream to the actual back rooms level that you're in, and he'll attack you, and you'll be too weak to fight him off. And he keeps you in this dream for longer by jump scaring you or making fun of you to the point where you can't fall asleep.