I'd often wondered how jokes came about until I tried this. Once your mind locks into the formula (and they are very formulaic after all) they just seem to come out forever. The book had a quote from some standup whose name escapes me, and he said the trick is to write 30 new jokes a day. Do that for a year and you'll have over 10,000 jokes. If only 1% of them are great jokes, that's still 100 great jokes. A standup can make a good living for a year out of 100 funny jokes.
The guy who wrote the book said that he made a living from selling one liners to standups. He'd give them a list of say 100, and they'd buy say 5 for $100 each.
I couldn't do standup though, even if I had great material. I would choke.