Why do authors use apostrophe in literature?
To show thinking out loud, and to create drama and interest in an otherwise mundane scene.
The literary device of apostrophe , not to be confused with its twin of punctuation, is when a speaker addresses an imaginary person, inaminate object or concept as if they are alive and listening. An example of apostrophe is from this well-known nursery rhyme:
As you can see, the author Jane Taylor is talking to an inaminate object, a star, as if it were alive, and thus uses apostrophe.
The purpose of apostrophe is to give brevity and drama when a character is thinking out loud. A famous example of this is in Macbeth when the gravedigger hands Yorick's skull to Hamlet, and Hamlet goes on a soliloquy:
"Let me see. (takes the skull) Alas, poor Yorick! I knew him, Horatio, a fellow of infinite jest, of most excellent fancy. He hath borne me on his back a thousand times, and now, how abhorred in my imagination it is! My gorge rises at it. Here hung those lips that I have kissed I know not how oft. —Where be your gibes now? Your gambols? Your songs? Your flashes of merriment that were wont to set the table on a roar? Not one now to mock your own grinning? Quite chapfallen? Now get you to my lady’s chamber and tell her, let her paint an inch thick, to this favor she must come."
In this scene Hamlet is in the graveyard faced with a physical symbol of death, a concept he has been brooding over for the whole play, and one which he now accepts. Shakespeare uses apostrophe here to paint a gruesome visage of Hamlet actually talking to a skull, but also to relay the metaphorical imagery that Hamlet is, in a way, talking to death itself.
I hope I helped!