They are archives.
They are places where the public can ask for the skills of a professional researcher.
They provide critical civic and informational access to the underprivileged. You can see this mandate in the libraries as free Internet terminals initiatives.
They are community centres with art, fitness classes, galleries, gyms, meeting rooms.
They are daytime shelters for the homeless.
And probably more. As someone with a library degree you'd think I'd know but honestly spent half my degree hearing librarians talk about what is the future of the library without getting to the heart of the matter.
Obviously without books libraries are community centres and so the future of community centres is likely to improve especially as the world urbanizes.
And very likely informational stores will not need to be physically bounded and can be centralized on the Internet (Google) and even so if localized (Yelp, Ancestry.com, Wikitravel). That is just economics.