Comedy, oh boy, where to start.
While watching other comedians can teach you a lot (if you pay attention to their structure, and not just their jokes,) you really have to find your own style. It is too simplistic to say that all you do is get up on stage and tell jokes. Some get up and their whole act is just the telling of a story. Others do comment on society, both subtly and overtly, and others just go crazy.
One of the first things to decide is if you want to go "blue" or not. I know three comedians who are successful without getting overtly nasty. It does not mean that they are bland or innocent in their act. I saw Tom Burgoon (you have to see his act if you get a chance) follow a blue comedian who bombed. He was on stage less then 30 seconds and had the audience rolling with laughter.
The biggest problem with dirty humor is that too many people mistakenly think that it is being dirty that makes it funny. But the truth is that it takes humor and adds a shock value to push it up a notch. By itself it can become boring and stupid. The blue part becomes a crutch.
"I just flew into town, and boy do my balls itch."
I get laughs with this all the time, but it is because it takes you down a familiar road, and suddenly takes a left turn. I am not sure this joke would work without the blue nature, (mild that it is,) but it is the surprise that catches a person off guard that makes it work.
Another thing to decide is your "Character." You generally cannot just try to be just like another comedian. Often it is best to get up on stage and just be yourself. When Richard Pryor started out he idolized Bill Cosby. He tried to emulate him, but it just didn't work for him. By changing his act to better suit his personality he became successful.
The biggest rule in comedy is that there are no rules. Sometimes the best thing to do is something different then what everyone else is doing. By finding a common rule and breaking it in a good way you can sometimes find success. Wendy Liebman was very popular a few years back by doing a unique delivery. She would say something completely normal, and right where you expect the sentence to stop, she would add a line to completely change the meaning of the previous sentence.
Another person I am acquainted with (i.e. I have talked to a couple of times, but wouldn't remember me from Adam, (where did that term come from? (How many nested parentheses can I get into this paragraph?))) is T.C. Hatter, who is a clown, and does a completely silent act with his wife Marcianne. She plays music while he performs. This is another example of breaking the rules, and coming up with a completely unique act.
One thing though is never ever steal another persons jokes, routines, or act. It would become impossible to work with other comedians, and many clubs won't hire people who steal their material. Unfortunately magicians have a reputation for stealing material, and have a little less respect with comedians. Though it does not help that if a magician has a good act it is easier to become a closing act.
Make sure you record every performance you have. You can find out what works and what does not. Make sure that your best material is at the beginning and end of any act. And when you add jokes, add them at the middle. If it bombs, nobody will remember. Also, any improvisation you do that goes over well will be recorded, so you can easily add it to your act.
Hope this helps, and good luck.