Don't all band members, in some sense, write every song? I mean, Dave and Adrian both got to write riffs, melodies, and solos for every song. Nicko's got to write the drum parts, Steve's got to write the bass lines, and Bruce's got to work out how the lyrics are sung and delivered. I never understood how somgwriting credits were established. I guess it goes to the person who came up with the idea?
It depends on the band/ artist. Your description fits how Queen used to work - the key idea being "the one who writes the tune (that is, skeleton of melody and lyrics) gets the songwriting credit (even though the others had contributed the rest of the orchestration)". They decided they would credit all members on each song from
The Miracle (1989) onward.
Much more cynical methods are sometimes used: the music on the
Bark At The Moon album was written mostly by guitarist Jake E. Lee (with additional input from bassist Bob Daisley and keyboard player Don Airey). However, only Ozzy Osbourne is credited on these songs because they (Sharon) basicly told Lee: "We have got your music on tape now: either we buy you out (and give the songwriting credit to Ozzy alone while you get a modest sum of money and no copyright to the songs), either you have nothing".
As far as Maiden is concerned, Adrian Smith tends to write full demos (with drums) or to show what he has in store to Bruce Dickinson who then tries to develop melodies and lyrics, while Steve Harris tends to explain to the others what he wants face to face. I think I haven't read about how Dave and Janick work (they don't write lyrics so it must be like the Smith/Dickinson collaboration). Nicko has only written one song ("New Frontier" on
Dance of Death) on the bass and "showed" the results to Adrian and Bruce who developed it into a song.
Sometimes, members are bought out too: Blaze Bayley collaborated to what became "Blood Brothers" and "Dream of Mirrors" (among others) but he was paid off and doesn't appear in the credits, since he was out of the band when these songs were released (on
Brave New World). Bruce Dickinson contributed a lot to "Children of the Damned", "The Prisoner" and "Run To The Hills" but for legal reasons (he was just leaving Samson whose label still owned the publishing rights to what Bruce wrote), he was bought out.
Sometimes, writers are alledgedly robbed of their rights (business is business): the lyrics to "Strange World" and "Charlotte the Harlot" were supposedly written by the first Iron Maiden singer Paul Mario Day (Dave recognizes himself that he has never written a single word of lyrics and the song is credited fully to him), while the drum intro to "The Ides of March" was brought by Barry Purkis aka "Thunderstick".
The story behind who wrote "Sanctuary" is also a bit unclear to me: it is credited "Iron Maiden" now but over the years, it had borne different credits (Harris alone, Harris/Murray, Harris/Murray/ Di'Anno...) and a tape of 1977 dug out recently (cf the thread "Dennis Wilcock", credit to
@fekso2017 and
@Magnus ) suggests that former members Bob Sawyer ("Rob Angelo") and possibly singer Dennis Wilcock too had a hand in the writing of the song.