Most people are dumb. Most, besides me and you. (Imagine I just said that last sentence with my hand beside my mouth, tilted conspiratorially towards you, so no one else could hear me tell you that. It's an aside.)
But even though most people are dumb - present company excluded of course (hand again) - sometimes, despite themselves, people say smart things.
So how should you respond?
Obviously, you should acknowledge the smartness of that thing that was said, thus confirming your own smartness, at least insofar as your ability to recognize the smartness of smart things that are said in your presence. Otherwise people will be all, "Did you notice that Bill didn't even realize how obviously smart that smart thing I said earlier was?" and "Bill must have his head up his ass." But you did notice, didn't you? Of course you did. You're smart.
However you don't want people who say smart things to get too full of themselves and start to think of themselves as better than or even equal to you which, obviously, no one is.
So here's what I suggest:
Recognize the smartness. Go for it. All in. Just go on and on about it. "How insightful!" "Very impressive!" "Never heard it explained that way!" "Really opening my eyes right now," etc.
Then - and this is key - indicate your (pleasant! be pleasant!) surprise to find them speaking so intelligently. Continue your barrage of compliments with "...which is just so wonderful, you know, considering." Then nod and wink knowingly at them.
Now look at your watch. Gaze at the clouds. Wait for it.
"Considering what?" they'll say.
"Considering... you know, what you..." Trail off here. Pretend to think. Hesitate as you feign the realization that you shouldn't finish your sentence. But then, meekly, you do. "...considering...what you look like."
They will likely be offended, incredulous even. Now's your chance to clarify: "Your face I mean. Just your face. You know." They won't know. "You just don't look... smart."
Struggle to explain. Use your hands. Pause. Appear to gather your thoughts. "Okay, wait. I'm not saying you're ugly. I'm not saying that. What I mean is that, because of how your face looks, and the stuff you usually say, you're... you know. Usually you say dumb things, with your stupid face. Right? Dumb-ish. Ohhh, you know what I mean. That's a nice tie Bob. I gotta go."
Aaaaand walk away.