When used correctly, it means that something is really true--not an exaggeration. So if you say, "That film literally gave me nightmares," it means you actually had nightmares about the movie after you saw it. But you can't say, for example, "I literally died laughing when I heard that joke," because you can't speak after you literally die!