A simple joke formula is:
setup (topic), information and attitude about the topic, punch line.
Here's some things I think about when writing such a joke.
First thing you need is passion. Writing is fueled by passion. Pick only the topics that grab you, SERIOUSLY grabs you.
Investigate your topic. The more you know about it the more there is to write about or at least gain ideas.
When you first start thinking about a topic you feel a need to talk about in your act you are looking for ideas or funny images, not necessarily to begin writing. Flush out as many ideas as possible through tangent lists or ballooning. One or two word descriptions, feelings, images ...on and on.
The idea behind writing is you are simply putting the correct words to these ideas, not making words form your ideas. Get it? The reason I say that is some new writers think that if they just start writing the story or joke will just form. It doesn't. Ideas first, then write. And if it's stand up comedy you're writing you won't be writing much. Stand up is emotional and emotions most times are best expressed in a few words...especially comedy.
When you finally begin to write do just that. Don't worry so much about editing. As a matter of fact turn the editor in your head off. Scribble in a hypnotic automatic rant like way, just go off and record it as best you can, audio recording is especially good because you capture the PASSION, etc.
Remember that in stand up each topic is like a very short story or play. It must have a defined beginning, middle and ending that is the punch, the laugh inducing twist, the trap door....the emotional outlet.
Be clear in your setups, keep it personal as much as possible, let your audience know why you're talking about what you're talking about and why you're telling them about it. Consider your audience, they are after all why you're doing this. Put yourself in their place, ask yourself if you were in the audience would you understand the setup and be willing to follow along with your story?
Remember also the audience wants and needs to get to know you. They wish to feel your attitude and get wrapped up in your world.
A word about punch lines.
In stand up comedy punch lines need to be strong. No puns or cleverness will do. You may use puns or cleverness on your way to your punches.
The punch must make them spit up. If your punches don't have this kind of strength, consider rewriting until they do. That is of course, if you really want to get big laughs.
When a loaded emotional situation is laid out with the right attitude and passion, a surprise punch will put your audience over the top. That's not just a joke, that is how you do a killer joke!