The comma is quite an expressive punctuation mark and is governed by a set of fairly complicated rules or guidelines. One of the most accessible descriptions of its use can be found in Perfect Punctuation by Stephen Curtis.
The comma acts as both a linker and a separator.
Commas are used to link the items in lists of words. phrases and clauses of the same type, usually replacing and. If the comma cannot be replaced by and, it is in the wrong place.
There are two systems for using commas in lists: A, B and C and A, B, and C. The final comma in the second system is called the ‘serial comma’.
Commas also link subordinate clauses to main clauses.
Commas acting as separators generally work in pairs, except when they are placed at the beginning or end of a sentence.
They also mark off sentence adverbs.
Commas are not used with defining relative clauses ( those in which the subject of the clause is one of a number of people or things of the same type).
Commas are used with non-defining relative clauses (where the subject has already been identified and the clause gives additional information).
Commas are used when you put the name of the person or people you are speaking to into your sentence.
It is easy to misuse commas but just as easy to use them effectively to get your exact meaning across.
As usual this list of guidelines can seem a little confusing but in practical terms the comma is usually used to ensure clarity of meaning. It is possible to use very few commas in short sentences, if the meaning is still clear. In these situations it is grammatically correct to use the comma but not necessary; you have a choice. Punctuation and phrasing choices are part of what give a writer his unique style. The purpose of punctuation, in all cases, is to signpost meaning. It is up to the writer to decide how to construct his work.
If you find the grammar a little confusing then I suggest a look at Perfect Punctuation (Stephen Curtis,Random House). He gives clear examples of each punctuation mark and the places where you may use them if you choose.