You said, in part: Why are there "random" identity checks in the library anyway?
***
I think the library is for student use only. In order to monitor this, students are asked, randomly, to produce their ID cards. Sounds fair enough. How else would you determine if someone were a student?
Can't speak for UC-Davis specifically, but most all public university libraries are just that, public. Usually the rule is like so: anyone can use the library, but you have to have a valid student ID or non-student library card (sort of an affiliate card) to check anything out.
If I understand correctly, UC-D has a policy of doing a 100% student ID check after 11:00pm as a safety measure for their students.