(Gonna answer you over here, since I already made a thread for librarian questions!)
The technical term for weeding is “deselection.” It’s basically just removing unwanted items from the shelves! Libraries have limited physical space for print books and limited resources for online collections, so items that are not serving a purpose must be removed - we’re libraries, not archives! Most libraries will have a deselection policy that dictates when, why, and how materials are removed.
Most public libraries have a standard that 20% of the collection be 5 years old or newer. So as we add new materials, old ones need to go. We use a few different metrics to determine what gets discarded - a common one is no circulations (checkouts) in the last two years. Other libraries set that at one, three, or five years. Items that are damaged or worn past usability are likely to be discarded as well, though if they are in-demand they will of course be replaced. Deselected items might be sold at a used book sale, repurposed for crafts in library programs, or simply recycled.
Other kinds of libraries, like academic libraries, might weed for other reasons as well. My current Tribal academic library was mostly stocked with community-sourced donations… So there were lots of things on the shelves that did not meet academic standards of rigor and needed to be discarded. Diet books, muckracking pop journalism, new-age garbage by white folks pretending to be Native, evangelical religious tracts… Yeah, it was a mess.