The animation pipeline

Overall production

No matter the type of animation, production for animated shows, shorts and features is roughly the same. This guide is based on working in a feature film studio, but of course roles may be shared between people (a writer may also animate) and projects may even be completed by one person.
Just like in live action filmmaking it all starts with a story, which is worked out into a script. Depending on the writer and production, this script may have varying levels of detail - one may decide to let the artists make whatever set they want, while another may describe the characters and settings very vividly.
It is at this point that the character designers and visual development artists get to work. They create concept art of all the characters and locations that will appear in the film.
While the characters are being finalised, some scenes will have been worked out. They are handed over to storyboard artists, who draw rough layouts of each scene, like a comic, which are then edited together (either by them or by an editor) to create an animatic. At this point, scratch voices may still be used, as the cast often hasn't been finalised yet.
During the course of production, voice actors are cast. Traditionally, they'd record at the studio, occasionally in groups of two or more voice actors (for a more natural performance) but after the pandemic a lot of studios made the decision to start letting the voice actors record from local studio spaces (or even from their own homes) while an acting coach gives them instructions.
When a sequence is deemed to be good enough, it is locked, meaning it cannot be changed - this way, production can move on, even if some scenes still need to be rewritten. If the character models are also ready, it will go into production to be animated (and rendered, in the case of CG animation). In most studios, a fully-boarded scene will be played and the separate shots will be divided up between the animators. Reference footage is shot, to give the animators a rough guideline for their movements/timing and the animation is blocked out to give the director an idea of what the final scene's staging and pacing will be like.
When the film has been entirely boarded (or even partially animated), test screenings are organised, where audiences watch the film and give feedback. Due to the locking system, writers have time to reflect and make changes as the film is put together. (Whether that is good or bad depends on the production - last-minute changes can also backfire terribly.)
As animated scenes are finished they are given back to the editors and foley artists. When the film is almost done, a composer is brought on. Music is created to accompany the visuals, and everything is put together. Finally, the film is complete!

Animation is quite possibly the most flexible medium - other than time and budget, there are no constraints on what can be created. Changes can always be made, and with modern technology, it is becoming more possible to get further in the pipeline even when things like voice lines haven't been recorded yet. (Occasionally, animators will fully animate the scratch dialogue - the voice actors' lines are then edited in post-production, if needed, to match the timing.)
That also means that the above description isn't always fully accurate - there will be productions where some scenes are fully rendered while, for others, aniamtion can't even be started due to the lack of model for the side characters. There will be films where test screenings lead only to minor changes, or where they are almost nonexistent. There are films where locked scenes are deleted or rewritten at the last moment. Ideally, anything that makes it to the animation stage is something that'll definitely make it into the final film, but sometimes things just don't work out that way. (If you want a small taste of that, check some fully animated and rendered "deleted scenes" or buy a movie novelisation - you'll be surprised at how much can get cut at the last second!)