You probably already know that commas are used to signify a pause in a sentence, but there are many other rules that require commas as well.
In a list of actions or things, you separate each part with a comma. It is optional to use what is called the 'Oxford comma' (the comma before the 'and'). I'll demonstrate in both ways:
(With Oxford comma) Sally went to the store, picked up three apples, and went to the cash register.
(Without Oxford comma) Sally went to the store, picked up three apples and went to the cash register.
Personally, I prefer using the Oxford comma, but both are grammatically correct.
You can make commas act like parentheses by surrounding a group of words with commas. The rule here is that the sentence should still make sense even if you take the section out which is surrounded by commas.
This is correct:
Sally bought some apples from the store, which was called Mark's, and came straight home.
Notice that without 'which was called Mark's' the sentence would still make sense, it would just lose an explanatory detail.
When addressing someone
When addressing someone, you use a comma before you say their title or name. For instance:
"I hate your store, Mark!" Sally exclaimed.
The same thing goes if the title comes before. For instance:
"Mark, I hate your store!" Sally exclaimed.
Actions done at the same time
If you have one verb and you want to communicate that the character is performing a different action at the same time, you have to separate the verbs with a comma. This is very commonly seen just after a dialogue tag. Here is an example:
"I'm going to get a new apple," Sally said, motioning towards the produce aisle.
Another example is:
Sally swept across the dirty floor, grimacing at the unacceptable untidiness of the store.
Notice that the second verb is in a different verb tense, ending with 'ing' (although I don't know what this verb tense is called right off the bat).
Whew! That's enough commas for today! I'll write a part two later.