Tony was the imaginary friend of Danny Torrance. Because he has the "Shining," It allows him to detect spirits and thus makes him a target of the Overlook Hotel. It also allows him to see past, present, and future events through his 'guide', Tony.
Tony (his name taken from Danny's middle name, Anthony), is at first to Danny an imaginary playmate, then a source of fear, and finally a source of strength. Towards the end of the novel Tony reveals himself to Danny: "'Danny ... you're in a place deep down in your own mind. The place where I am. I'm a part of you, Danny.'" More specifically, Tony is Danny from the future: "Tony was like looking into a magic mirror and seeing himself in ten years"; "Tony ... the Daniel Anthony Torrance that would someday be."