Idioms are phrases which cannot be understood simply by looking at the meaning of the individual words in the phrase.
serve (someone) right
to get the punishment or results that one deserves
My friend never studies at all so it serves him right to fail his exam.
List of common idioms, their meanings and examples of their usage in sentences
An idiom is defined as - a group of words in a fixed order that has a particular meaning that is different from the meanings of each word on its own.