Elements of a sentence that are needed for the meaning of the sentence are called essential or restrictive and should not be separated from the main sentence by commas.
Example
My sister Joan has gone to New York.
Meaning
You have more than one sister. Joan is the one who has gone to New York.
Example
My brother who lives in Montreal won a million dollars.
Meaning
You have more than one brother. You want the reader to know that it's the one who lives in Montreal – not one of the others – who won a million dollars. Go and visit the Montreal brother!
Elements of a sentence that are extra to the main idea are called non-essential or non-restrictive and should be separated from the rest of the sentence with commas.
Example
My sister, Joan, has come for a visit.
Meaning
You have only one sister. She has come for a visit. The fact that her name is Joan is just extra information the reader might be interested in.
Example
My brother, who lives in Montreal, won a million dollars.
Meaning
You have only one brother. He lives in Montreal. However, where he lives is not important to the main idea because you don't have to differentiate the rich brother from any others. The main idea is that you are excited that he won a million dollars.
To check for essential / non-essential information, cover up the words you are wondering about and read the remaining sentence. Does the part that is left give the reader all the important information? If so, then the section you covered up is non-essential.
Essential Information
When referring to a thing/idea, if the information in a clause is essential, use that to begin the clause.
Example
The car that is red is mine.
Meaning
When you are looking for my car, just look for red. Although there are several cars in the lot, there's only one red car. It's mine.
Non-Essential Information
When referring to a thing/idea, if the information in a clause is non-essential, use which to begin the clause.
Example
My car, which is parked in front of the house, is red.
Meaning
There is only one car parked in front of the house. I'm very excited that it's red, so that's the part I really want you to notice.