The confusion over compliment and complement is an easy one to rectify! Both words share a Latin ancestor, complere, which means to fill, and which also gives us the words comply and complete.
Complement is more closely related to complete, hence the e. If your scarf complements your eyes, it’s not saying, “Hey, eyes, lookin’ good!” It is completing or harmonizing with your look.
Compliment comes from comply. I learned this reading Shakespeare: when Hamlet is making fun of the sycophantic dandy Osric, Hamlet says, "He did comply with his dug before he sucked it," meaning that Osric is such a stuffy stickler for proper behavior that he would pay his mother's breast a compliment before nursing. (I do wish I could find that scene for you, with Robin Williams playing Osric to perfection, but alas, poor Yorick, it seems you must watch all four hours of Kenneth Branagh's Hamlet to see it.)
Y turns to i when you add an ending:
Happy → happiness
Twenty → twentieth
So, the verb comply turns into compliment, which can be both noun and verb. But what do flattering words have to do with obedience and compliance? Actually, you are complying with or satisfying etiquette when you make a compliment. Hence the phrases “with my compliments,” or “compliments of the house,” or even "pay a compliment." A complimentary gesture is a gift of good will and welcome that satisfies, complies with, or fills expectations.
Compliment has an I, because it’s about stroking the ego. It’s all about me, myself, and I!
Complement has an E, because it’s about complEting something Else.
Et voilà! With my compliments.