In the beginning of every Hollywood movie, I can see like 3-5 studios(?) being listed with their logos (animated of course). How does this work? Why are there so many?
The first production company plate is for the Distributor, the studio who gets the film into theaters, cuts the DVD and streaming deals, etc.
Next up is the Production Company, this is the studio that financed and oversaw the production of the film.
Finally, any other companies that were involved in the production are listed. They may have provided financing, the rights, or other support to get the movie made.
Given the nature of the business, there are all kinds of combinations.
A fairly common occurrence is when the distributor is also a production company. Star Wars is an example where Twentieth Century Fox Film Corporation is both a distributor and a primary production company, along with Lucasfilm.
Much rarer is when there are two distributors. Titanic was such a hugely expensive undertaking that Fox brought in Paramount in exchange for US distribution rights, so the two studios were co-distributors. They were also the production companies of record along with Lightstorm Entertainment which is James Cameron's shop. Distribution for The Towering Inferno was split between Warner Brothers and Fox to avoid releasing nearly identical films at the same time.
Having multiple production companies is common. These are the films referred to by the OP with the multiple studio plates to open the credits. The Secret Life of Pets is an example where there are multiple (4) production companies associated with the film.
In short, however many studios had a big enough interest in either distribution or production of the film will get a credit. It all comes down to the individual deals and relationships for a particular film.