Connotation draws on past uses of a word to add to its definition the more subtle associations of a word, the "neighborhood" of a word. When a writer chooses a word from among its near-synonyms, he or she is bringing the word's "baggage" with it. There are linguists who argue in fact that there are no such things as synonyms, and the example they often use is "dog." "Hound" is different; "canine" may seem like a synonym but has a formal, taxonomic connotation to it, because scientific names cannot be blithely substituted for common, Anglo-Saxon words, or for words borrowed from another language. Some phrases, called frozen idioms, trap a word inside its connotation (for example, "prejudice" is pretty much trapped inside "racial prejudice" even though it "means" pre-judgement of any kind --another word like that is "discriminating," which is a good quality to have in aesthetic judgements, but the word brings with it negative connotations now). A writer keeps in mind the word's emotional impact as well as its denotation. There is a real difference between a "whore" and a "lady of the night" (or the euphemism "escort"), and a careful writer is aware of the difference.
Connotation refers to the extra meanings associated with a word beyond its dictionary definition (denotation). For example, when I use the word "rose" you might think of beauty, love, and Valentine's Day. When I say By definition, though, "rose" only refers to the red flower with the thorns on the stem. Carefully choosing words based on their connotation will provide added depth to a literary work. Not only will the author's message be transmitted in the basic sense from the dictionary definitions, it will also be carried on a more subconscious level as the reader associates different words with different meanings. This creates mood and establishes intimacy between the author and his readers.