I'll soon be leaving the faculty position I've held for over 20 years at a private college in the United States. Do departing faculty typically keep books that might have been purchased with university funds? After all of this time, it's hard to know which books I paid for, which were given to me, and which were paid for by grants or departmental funds. My department (which I head) is being shut down, so nobody will remain to whom the books would be useful.
There's the "legal ownership" element, but given the situation you've described, I'd attach even more importance to the moral/ethical element:
Who is most likely to use these books?
I suspect if your department is being shut down, no one will care about the legal ownership specifics unless you provoke them to. So you could consider triaging:
College library, for books which in your professional judgment students or faculty in other remaining departments could use.
Keep yourself, for specialized material or your favorite books that you expect to use in the next years or decades.
Gifted to colleagues elsewhere for other useful material in your field.
"Free" box outside your door, for the stuff you'd otherwise throw out.
I have fortunately not been in quite this situation in academia proper, but I did leave a private sector research institute that got effectively disbanded with my (and others') departure. This is the approach I followed.
That really depends on where you are. It seems that (albeit implicitly assumed) US, or Anglosaxon in general, consensus of the other asnwers is that a professors keeps their books.
However here, if university pays for a book through a grant or through department funds, the book gets registered into the library register and is marked appropriately with the numbers. These books are then sometimes marked as being borrowed from the library, sometimes just silently transferred, but either way remain a property of the library (and can even be requested for borrowing by other persons).
That does not include books that were sent to you from someone, only those bought through university money.
First, figure out which books you want to keep at all. Then ask the responsible person what you should do with the books you don't want to keep. That answer may reveal the answer to your actual question in your particular case.
I think the convention is that books bought by the university remain unless given to you, which a dean or VP might do. Those you bought are, of course, yours. Examination copies given to you by publishers are yours, even if they were trying to influence the university. Books bought with grants depend upon the provisions of the grant, but probably in general belong to the university, not the principal investigator.
Do not concern yourself with with ownership of downloaded material. Libraries expect scholars to download, use, and ultimately keep such material. That's why they have subscriptions.
Finally, if there are books you will not use, regardless of ownership, but that might be useful to a scholar in another department, see whether the library will take them.
I have been in similar situations three times when moving between universities and when retiring, in Norway. The tradition was, and is, that the books are kept by the professor.
My advice is that you honestly ask the dean what would be best to do with the books for the college. Chances are that the college is at most interested in very few of your books for special retain reasons.
At our department, this can go two ways: If I request a book for a class that I teach, the department will get me an "instructor's" copy, but will keep the book (although I can generally keep using it unless someone else decides to use it for their class as well). We also have a pool of money that can be spent on miscellaneous expenses, such as inviting visitors, attending conferences, books, or minor equipment. I can buy a book and request to cover the expense; if the department head/business office approves it, I will be reimbursed and can keep the book. There's no guarantee, however, that such a request will be approved and overall the money is more likely to be given to junior faculty with no external funding...
Better to beg forgiveness than to ask permission.
Go along with the assumption that you can keep them all. Keep the ones you want, and decide what to do with those you do not.
If you ask first, you may trigger the cupidity of a petty official who wants them for himself (for no reason but for the ownership) and it will then be far harder to retain control yourself of the ones you are particularly fond of. But if you have already taken your pick, and put them on your shelves at home, then it is far harder for an officious busybody in the university administration to claim them for the university.
It is also a fair bet that nobody will either know or care what books you have in the first place. Mind, it's a good idea to know exactly where they all are, in case someone with a list on a clipboard comes sailing into your office to mark off the ones they are particularly keen on reclaiming.