The Maester's chain, forged of different metals, is a symbol of service and an indicator of the wide learning the particular Maester has achieved. It is a symbolic ornament with multiple layers of meaning.
Jon Snow describes his conversation with Maester Luwin:
"He told me that a maester's collar is made of chain to remind him
that he is sworn to serve," John said, remembering. "I asked why each
link was a different metal. A silver chain would look much finer with
his grey robes, I said. Maester Luwin laughed. A maester forges his
chain with study, he told me. The different metals are each a
different kind of learning, gold for the study of money and accounts,
silver for healing, iron for warcraft. And he said there were other
meanings as well. The collar is supposed to remind a maester of the
realm he serves, isn't that so? Lords are gold and knights steel, but
two links can't make a chain. You also need silver and iron and lead,
tin and copper and bronze and all the rest, and those are farmers and
smiths and merchants and the like. A chain needs all sorts of metals,
and a land needs all sorts of people."
Quote is from Chapter 41 of A Game of Thrones, where Jon Snow tries to convince Maester Aemon to take Samwell Tarly under his tutelage.
As for the books shown in the Season 6 finale, there's no equivalent in the (Song of Ice and Fire) books that I recall, and certainly no exposition on (chains on books). However, where the chain is a symbol to the Maesters, it's quite reasonable for them to extend it to their libraries - just as the Cross is a Christian symbol that shows up on a wide variety of places - rosaries, steeples, Bible covers, bookmark tassels, chalices, communion wafers, sword hilts, stoles, tattoos, and bumper stickers.
It may also be that the chains are meant to index books - books having to do with finance would feature gold in their chains; books having to do with healing would feature silver; books on warcraft would feature iron. Allowing the Maesters to... ahem... judge a book by its chain.
After a rewatching of the scene, @BCdotWEB's answer appears more correct - the chains are linked to crossbars for security:
And the crossbars are locked to the bookcase with conspicuous locks at the endcap:
I recommend you accept @BCdotWEB's answer instead of mine.