The suffix -ly in English is usually a contraction of -like, similar to the Anglo-Saxon lice and German lich.The suffix -ly is related to the word like. They are also related to the obsolete English word lych or lich, and German Leiche, meaning "corpse"; according to the Oxford English Dictionary (entry on lich, etymology section), these words are probably descended from an earlier word that meant something like "shape" or "form". The use of like in the place of -ly as an adverb ending is seen in Appalachian English, from the hardening of the ch in "lich" into a k, originating in northern British speech.
In this way, -ly in English is cognate with the common German adjective ending -lich, the Dutch ending -lijk, the Dano-Norwegian -lig, and Norwegian -leg. It is commonly added to an adjective to form an adverb, but in some cases it is used to form an adjective, such as ugly or manly. The adjective to which the suffix is added may have been lost from the language, as in the case of early, in which the Anglo-Saxon word aer only survives in the poetic usage ere.
Though the origin of the suffix is Germanic, it may now be added to adjectives of Latin origin, as in publicly.
When the suffix is added to a word ending in y, the y changes to an i before the suffix, as in happily (from happy). This does not always apply in the case of monosyllabic words; for example, shy becomes shyly (but dry can become dryly or drily, and gay becomes gaily).
When the suffix is added to a word ending in double l, no additional l is added; for example, full becomes fully. Note also wholly (from whole), which may be pronounced either with a single l sound (like holy) or with a doubled ( geminate) l. When the suffix is added to a word ending in a consonant followed by le (pronounced as a syllabic l), generally the e is dropped, the l loses its syllabic nature, and no additional l is added; this category is mostly composed of adverbs that end in -ably or -ibly (and correspond to adjectives ending in -able or -ible), but it also includes other words such as nobly, feebly, triply, and idly. However, there are a few words where this contraction is not always applied, such as brittlely.
When -ly is added to an adjective ending -ic, the adjective is usually first expanded by the addition of -al. For example, there are adjectives historic and historical, but the only adverb is historically. There are a few exceptions such as publicly.
Adjectives in -ly can form inflected comparative and superlative forms (such as friendlier, friendliest), but most adverbs with this ending do not (a word such as sweetly uses the periphrastic forms more sweetly, most sweetly). For more details see Adverbs and Comparison in the English grammar article.