Delving in what might be considered the unethical side of authorship I know of some who have put a famous superstar professor on a paper where their contribution was extremely minimal such as having read it and making a remark or two. Another reason is an agreement between 2 authors to do a quid pro quo arrangement where author 1 writes a paper putting the name of author 2 (no contribution) on it for the return gift of author 2 (writer) putting the name of author 1 (no contribution) on the paper. Plus there is the scenario where a colleague at your university is going up for tenure and/or promotion and is a bit short of publications. The productive professor adds the name of the deficient professor onto a paper or two or three so as to boost the prospects of a favorable tenure and/or promotion review. A variant of this is the case of annual performance review where a professor needs an article to prevent being disciplined for subpar research performance.
One traditional practice was that if the research was done in a research center or lab, the center's director's name would be included as an author. The rationale presumably was that the director's management of the facility contributed to the research by providing the conditions that made it possible. I think in that context the list of authors is similar to the credits at the end of a film, except in that case the individual contributors' roles are more clearly specified. Another way of thinking of it is a sports analogy: a winning score (research) is produced by a team, and although the individual team members make different contributions at different times, the whole team is credited for each game won (published output).
I find the Vancouver rules very helpful when discussing authorships: http://www.icmje.org/recommendations/browse/roles-and-responsibilities/defining-the-role-of-authors-and-contributors.html
Also, the COPE material is very useful as well: https://publicationethics.org/authorship
To answer your question, I fear that often authorship is granted for not so noble reasons when there has been no contribution at all. Sometimes the person/s who got the grant paying for the research get authorships although not contributing to the actual research, however providing the money and the main research idea so to speak.