In grammar, a restrictive clause, word, or phrase provides crucial clarifying information about a previously named element. A nonrestrictive clause or phrase adds information that is not essential to the meaning of the sentence.
Let’s identify the restrictive and nonrestrictive elements in a few examples:
 Democrats in the state Senate fled Wisconsin on Thursday … [Wall Street Journal]
The phrase in the state senate is restrictive because Democrats without the modifying phrase would be confusing. We need to know that the writer means Wisconsin state Senate Democrats rather than all Democrats.
 The protests have mostly occured in the east of the country, with Benghazi, Libya’s second city, seeing clashes … [Guardian]
In this sentence, Libya’s second city clarifies but is not crucial, so it is nonrestrictive.
 Turabi’s political party, which grew out of the Muslim Brotherhood, never received more than 18 percent of the vote in national elections. [NPR]
The dependent clause which grew out of the Muslim Brotherhood, is nonrestrictive because the sentence would make sense without it.
 Morley, who is 22, is still a productive scorer … [Watertown Daily Times]
In this example, the player’s age is nonessential information, so the clause who is 22 is nonrestrictive.
 Another person who is in direct contact with Apple also said that the company would not make a smaller iPhone at this time … [NY Times]
The clause who is in direct contact with Apple is restrictive because it’s crucial to the meaning of the sentence. We need to know that the person is not just some man or woman on the street.
In general, as the above examples demonstrate, commas should be used before and after nonrestrictive clauses and phrases, and commas should be omitted around restrictive clauses and phrases.