A rotisserie motor driving a shaft with some cams attached seems like the easiest way to go for this. You can stagger the rotation of each cam to push a book as needed. No holes or damage need be done to the bookcase, as it would be self-contained. Problem would be; it could only work for one shelf unless you drill a hole for the camshaft to pass through to the next shelf over.