I won’t rehash the lay/lie issue, except to remind you that “to lay” is transitive (taking an object) and “to lie” is intransitive (not taking an object). The problem here today is that “underlay” and “underlie” are both transitive verbs, so knowing how lay/lie work will do you no good whatsoever except to help you know how to spell the tenses.
(Full disclosure: I got myself so confused during a recent project that just today I emailed the client and told them to ignore the changes I’d made to “underlain,” because it turned out I was wrong. I own my mistakes.)
So. We have “to underlay,” meaning “to put something under another thing” or “to provide a base or a support for a thing.” And we have “underlie,” meaning “to be under or below something” or “to be the basis of or support for a thing.”
Underlay, underlaid, underlaid, underlaying (cf. “lay”)
Underlie, underlay, underlain, underlaying (cf. “lie”)
Let’s give this a shot, shall we? Say we have a construction crew, and they’re working on the flooring in a given room. They underlay the carpet padding on top of the plywood subfloor, before putting down the carpeting.
This leads us to saying “Carpet padding underlies the carpeting proper.”
Let’s take it another step, into the simple past tense. Yesterday the crew underlaid the padding for the carpeting. The padding underlay the carpeting.
One more step, into past perfect/pluperfect tense. The crew had underlaid the padding last month but didn’t get to the carpeting until today. Years from now, a CSI specialist will note that the padding had underlain the carpeting. (That’s a crap sentence, but at least the tense is right. Making up exemplars is a pain in the arse.)
Now, to the thing that tripped me up so badly: what do we use when we want to say something formed the basis of something else, as in provided support? As in: “The scent was [underlaid/underlain] by a sour note.” Well, that sour note wasn’t put there as a support; it forms the basis for that scent. We want underlain here. Turn the sentence inside out by making it active: “A sour note underlies the scent.” It provides the basis for it by virtue of its existence.
If someone or something physically places a thing to provide support for another thing, they underlay it. If a thing provides support by its existence, it underlies the thing it supports. Both verbs are transitive. Figuring out the tenses isn’t so difficult, once you have that difference in your head.