Most words ending in "-ic" show an anglicization of the Greek suffix -ikos.
Older words of this form came into English from Greek by way of Latin (in which -icus replaced -ikos), or from Latin "Hellenizing" coinages, or from French borrowings (in which the ending became -ic, later -ique) of either of these.
These were often spelled with "-ick" ("historick") until spelling became regularized in the 18th Century.
Newer words, especially technical terms like lactic, are modern coinages.
Words ending in "-ique" are borrowings from French (and may be French borrowings or coinages) which entered English as recognized "foreign" terms after English orthography settled down. There's only a handful of these in ordinary use: antique, boutique, clique, critique, mystique, pique, technique. Note that in all these the accent falls on the final syllable, as in French. Some have "nativized" doublets, with the accent on the penult: antic, mystic, technic.
Unique belongs to both categories. It first appears in English in the early 17th century bearing the sense "only", and is usually spelled "unic" or "unick". It never really catches on; but, according to OED 1, it was in the sense of "the only one of its kind"
readopted from the French at the end of the 18th c. and regarded as a foreign word down to the middle of the 19th, from which date it has been in very common use, with a tendency to take the wider meaning of 'uncommon, unusual, remarkable'.