Also, the exact needs depend on the neighborhood, but libraries help with a lot of social issues. I spent a fair bit of time helping kids who spoke little English with their homework, digging up resources for dealing with bad landlords and other legal complications, assisting with resumes and unemployment paperwork, etc.
If it was just another Barnes and Noble, it'd be different, but libraries are supposed to be a public resource for finding information. Research librarians were the original search engines, you know. :)
(Academic, medical, etc. libraries serve different roles, of course. I'm just talking about public libraries.)