In a system there are conservative and non conservative forces. Other than this work in a system is affected by externally applied forces. So the total work done in the system is the sum of work done by these 3 categories of forces.
Conservative Forces:
As you saw when lifting a book, the work that you do "against gravity" in lifting is stored (somewhere... Physicists say that it is stored "in the gravitational field" or stored "in the Earth/book system".) and is available for kinetic energy of the book once you let go. Forces that store energy in this way are called conservative forces. Gravity is a conservative force, and there are many others. Elastic (Hooke's Law) forces, electric forces, etc. are conservative forces.
Nonconservative Forces:
As you say when pushing a book, the work that you do "against friction" is apparently lost - it is certainly not available to the book as kinetic energy! Forces that do not store energy are called nonconservative or dissipative forces. Friction is a nonconservative force, and there are others. Any friction-type force, like air resistance, is a nonconservative force. The energy that it removes from the system is no longer available to the system for kinetic energy.