it has nothing to do directly with bpa, it has to do with when the effects are (a) equivalent to other buildings in your province taken together or (b) useful for their own sake.
(a) is usually applied to farms only, since the other types you'd either want to maximize outputs, or other buildings do better. (b) is usually for channeling science, since it stands alone for wpa and improves your rune production as a bonus. Technically, if you invest roughly even levels in everything, the rule of 1% libs per 100 bpa generally holds true, but libs don't replace certain building types. An attacker can usually play without libraries and lose very little, if they need land for hospitals and whatnot. Generally though, libs are for provinces with a strong magic affinity, which should be a lot of provinces in war kingdoms. I'd want them for Undead, Avian, Human, and the t/ms. Orcs have crap science and want a lot of other buildngs. Dwarves really like the reduction buildings (wt, gs, hosps) that libs can't replace, and libs ignore their BE bonus anyway. For an attacker, you'd probably build them for the free farmland and minor econ buff, but wouldn't bother rebuilding them... and attacker land is so volatile that you really can't micro in libs. t/ms should swear by them if they can hold on to worthwhile sciences, especially Elves.
Using libs in war as a chained province has some utility, mostly for the huge +wpa - but spellcasting is still a crapshoot due to nw penalties, and there are much better building strategies to use post-chain.
If you have super good sciences, like 400+ bpa in everything, then libs are pretty obvious regardless of race or role, but they're still not replacing a lot of building types. Having the better numbers is usually worth it for a/t/ming, assuming you give no ****s about amnesia or learn attack.