There are characters in movies who I call 'film characters.' They don't exist in real life. They exist to play out a scenario. They can be in fantastic films but they are not real characters what happens to them is not lifelike.
I think a lot comes from having the experience of doing stand-up comedy. It allows you to figure out the psychology of an audience what things are funny and not.