The best advice I've ever heard for how to write alt text:
Write alt text like you're explaining the picture to someone over the phone.
This is perfect! Now, there can be a lot more nuance to alt text than that, but this is really a fantastic starting place. This simple guideline can help you consider what you think is important for the user to know about the picture. It also helps you put yourself in the shoes of the user — e.g. a person using screen reader software — and can help you understand what things they would want to know about the picture, as well as what things they wouldn't need to know. For most instances of alt text, this method really does the job.
This simple guideline can also help you decide which images need alt text. Some images convey useful information, and some don't. We should not include alt text for images that don't need it. If you were reading and describing a webpage to someone over the phone, you wouldn't describe things like a swoosh-y divider graphic, or an envelope icon next to the text, "Email us."
While we're talking about writing alt text, you might want to check out my article on alt text basics. Understanding what alt text is and how it works — and there's more to it than you might think! — can really help inform how to write good, relevant, effective alt text.
– Manning
Questions/comments? Feel free to contact me at manning@manningkrull.com. I update these articles pretty frequently — best practices evolve over time as the world of digital quickly changes, and I always welcome insights from others.