Dialogue is one of the ultimate tools for a writer, and it's one of my personal favorites to play with, experiment on and just have fun putting on the page. Once you learn the rules of where to put your quotation marks and expand past the He said... She said... stage, dialogue becomes one of the most versatile functions of writing. It is that because it cuts both ways, both fleshing out the characters and explaining how the world around them works, how it looks, etcetera.
For me, dialogue is fun, but it's honestly still tricky. It's a very tricky balance between having the characters talk like, well, real people, but still being original enough to seem like an actual character and not just me writing my own thoughts inside quotes. A lot goes into writing dialogue that has nuance and heft but still comes across as believable.
Here's the thing: each character you write for has to have their own voice. A lot of writers take "write what you know" too literally, either intentionally or not, and all of their characters sound the same when they speak. Some even fall into a further trap where there's no real distinction between the narration and the dialogue, beyond the aforementioned quotation marks.
There's a difference between "voice" and just how a character's dialogue is structured though, and it's a rather important one. Voice isn't just whether a character speaks with a Cockney accent or ends every sentence with a verbal tic. Voice includes things like how sarcastic a character is, what sort of sense of humor they have, whether they cry or they scream, whether they comfort others or make fun of others, the list could go on pretty much forever.
A lot of work goes in to making each character sound unique. Tone is a major part of it, as is voice, but it's not easy to make that work. There are some tricks to it, but it really depends on how deep into the craft you want to get. Something that you can change up in the dialogue itself is tweaking the words (like changing the word here to 'ere) and mess with how things are spelled.
The logical extension of that is of course accents. Dialogue is a very flexible medium, but it can get strained pretty far if you put a thick accent into the written word. Being the person I am, I don't mind it that much since I grew up reading the superb Redwall series, wherein Brian Jacques gave each race of characters their own spin on a UK accent. But it can throw readers for a loop if they aren't able to understand what a character is saying. On the other hand, though, just saying that a character has an accent is different from having it spelled out in the actual words on the page.
There are extensions of that, going in to the punctuation around dialogue, playing with how the dialogue itself is framed around and between more narrative bits or character actions. These sorts of techniques are actually beneficial beyond just affecting the character's voice, they also help break up the dialogue itself and make it more dynamic. Since I write straight, plain prose and not screenplays, I have to frame the action and delivery of the words in a way that helps a reader imagine how it plays out in my head.
A huge part of the dialogue work that I change are little things, different little tricks and tips to help make characters different even before we get to understand them. Something I do sometimes is to switch up whether I use contractions. A character who doesn't speak with contractions naturally sounds more sophisticated (or more pretentious). A character who over-uses contractions, on the other hand, naturally sounds more informal and colloquial. I also like to change up the vocabulary, letting the more educated or verbose characters use longer and more unusual words, while the less urbane ones are more limited.
These are only a few of the tips and tricks, of course, I could write a whole book on how to work with dialogue. But since this is a blog, I'll stop here. And next time, I'll go into the prose of the work a bit more and how narrative changes things differently than dialogue.