Perhaps what is most distinctive about the music in "Another Brick in the Wall, Part 2" are its un-Pink Floyd aspects.
The band was often labeled as acid rock in its early years and also showed a willingness to dabble in R&B and even country. The band would come to be defined by its cutting edge psychedelic sounds, which when combined with a tendency toward the thematically dark and gloomy, produced strictly made-for-adult music. But "Another Brick in the Wall" rests on a surprisingly trendy disco beat, and the vocals in the second half of "Brick in the Wall" are provided by a children's choir.
Both of these surprising elements can be laid at the feet of Bob Ezrin, who was brought in to produce The Wall in 1979. Ezrin was already thinking about making a single, so he sent Dave Gilmour out to some disco clubs to get a feel for the trendy rhythms. It almost backfired. "I forced myself out," remembered Gilmour, "and listened to loud, four-to-the-bar bass drums and stuff and thought, Gawd, awful!" But the band eventually went along with the idea "so it would be catchy." (Source)
The song, as recorded, was too short for a single, and the band was not interested in recording a second verse, or even producing a single for that matter. So, Ezrin also came up with the idea of having a school choir sing the second verse. Ezrin, who had recently produced Alice Cooper's "School's Out," had an engineer find a local choir to record the track.
Pink Floyd created concept albums that were, for the most part, produced collaboratively. After the departure of Syd Barrett, Roger Waters usually took the conceptual lead, but the other musicians contributed significantly to the finished products.
While this remained partially true for The Wall, the responsibility for the songwriting was less balanced and leaned more toward Waters than the other members. One indicator of this is the album's writing credits—all songs are attributed to Waters except the four in which he shares credit.
The concept behind the album emerged during the band's In the Flesh tour. Water's confrontation with an unruly fan led him to reflect on the sorts of things that had alienated him from his audience, and which isolated him and others more generally from society. Waters developed a broad storyline for the entire album, pitched the idea to the rest of the band, and then worked with recently recruited producer Bob Ezrin to develop the concept further.
This led to the construction of a fifty-page album script that was less narrowly autobiographical than Waters' original story. While Waters' own experience would continue to inform the story—the death of his father, his overprotective mother, his schooling, etc.—the story that would become the album was more broadly framed. Once complete, the script was read by the band as though they were rehearsing a play.
Waters received sole writing credit for "Another Brick in the Wall, Part 2" and it's one of the songs inspired by his own experience. But producer Bob Ezrin had played a large part in constructing the song. He was responsible for the uncharacteristic disco beat, and he had turned a one-minute track into a three-minute single without the assistance and, initially, the support of the band.