To compliment and praise someone is to acknowledge the good work they've already done. A kind word to the musician after a concert, to an author about their book, to a well dressed man about his outfit, all these point back to the person's achievements.
But what about the person who didn't quite cross the finish line? The husband who went for an interview but didn't get the job, the student who studied all semester but only got a "C" on the final; these people know they failed, and an empty compliment to make them feel better won't help.
Never falsely compliment, saying a person did "a great job" when it clearly wasn't, but do acknowledge their effort. It's in the moments of defeat when we need encouragement the most; knowing our efforts were in vain, but we made a good effort nonetheless. It costs us nothing to encourage someone else, so be sure to do it often.