What's the rule for dialog tags? Does there have to be a tag after every piece of dialog except when they're talking back and forth, or can you just include the tags when you think they're needed?
You can just include tags when you think they're needed. You can also often use beats instead of tags.
Just include the tags if they're needed. It would get very annoying or distracting to read: "I just went to the store," said Kim. "Nice, what'd you buy?" asked Martha. "Ah, things," Kim replied. "Ah! I see, no details?" asked Martha. When there's two people, you don't always need to do it.
There only needs to be a tag when things are getting a bit confusing (likely because it's been a while since the last one), or if it adds something to the text. No one particularly wants or needs a tag after every bit of speech, because it's generally going to be redundant and either going to get repetitive ('XYZ said' ad absurdum), or ridiculous ('XYZ postulated').
It's probably best to not use tags/beats every time - gets a bit tedious to read "she said" / "[name] said" over and over again! A lot of the time you can infer from context who's talking, especially if it's only two in a conversation. Gets a little trickier with more than that. And like Chicken brings up, utilize beats. People will understand that "Yeah, I don't think so." Sarah smiled. implies that Sarah is the one who owns the dialogue. More complicated ones - like a longish chunk of action from one character followed by dialogue from them - usually come through clear as long as you're staying with the same character. Clarity is the only real factor when you're on the more minimal side.
I use dialog tags almost all the time. And I almost always use said. I don't think it gets old or repetitive, but I do think it adds clarity. I find it much easier to cut some if needed than to try and figure out why things got confusing and where I went wrong. This is just one of the things that helps me stay on track while writing.