Excellent question. I suppose the answer lies partly in how the libraries respond to changing technology and attitudes toward reading. The growing trend in e-reading and such is making a big impact on the publishing industry already, so everyone has to adapt or else become irrelevant.
One other big problem libraries have is funding, so they will have to learn how to diversify their funding efforts, perhaps become more relevant to corporations and not just the government to fund them.
They need to start getting more "with the flow" and become more e-accessible, especially the tiny libraries in small towns or that serve whole counties.
If I were to venture a brutally honest opinion about what libraries would be like in 25 years, I'd say there wouldn't be many anymore. I think most would have closed down and become more like virtual networks, where subscribers could download a book or media file to their personal account, pay a subscription, like any media site. In 25 years paper books might (sadly!!!) be a thing of the past. Since I love curling up with a good book (a Kindle just isn't the same!!!), I don't think this is a good thing, but I think it's most likely to happen.
The only way to avoid it is for private citizens to start getting active with their local libraries, donating money and time, etc. Considering how jaded so many people are nowadays, I'm not too optimistic...but I'm hopeful!