(Now edited to add actual content.)
The basic gist of how to write small talk is pretty simple: Don't.
Why? Because it's really hard to write good "small talk."
To make it clear, "small talk" is dialogue with no particular purpose. When a character is speaking, it takes up time and energy. If s/he is "making small talk," s/he's wasting your time and energy. (I recall that I once dropped a webcomic because there was some small talk that was so painfully bad that the comic had essentially jumped the shark for me after I read it.)
A few people can make good use of small talk. One of the few effective ways to use it is to use it to entertain the reader while setting up for something else; this is most effective in a comic format in my experience (although Douglas Adams mimicked small talk to some degree in the narration of his books while giving exposition).
It should also be noted that, while talk between characters can be "small talk" for them, if it is either entertaining or naturally flowing exposition, it is not functionally small talk for the reader.
Another feature of small talk used in this fashion, incidentally, is that it is usually funny and often intensely ironic. I recollect an episode of the '90s era X-Men cartoon that featured a pair of security guards arguing over whether their current discomfort was the result of heat or humidity; shortly thereafter, Iceman broke into the facility, and it was quite promptly cold that was responsible for their discomfort.
Here is an example of the elusive creature that is "effective small talk," as little as I want to use the phrase.
Dude: Dude, I think women are hot.
Guy: I must heartily concur.
(A shadow comes up behind them.)
Dude: Aren't they totally hot?
Guy: Did I not just agree with you?
(The shadow is towering over them.)
Dude: I like-*ghrk*
Guy: AAAAAH MONSTER BLAH BLAH FISHCAKES!
(The shadow thing eats them or something.)