Aggregate five individual objects to desired output using jq
Just a series of transformation is all is required, starting with group_by()
jq -n '[ inputs ] | group_by(.author) | map( { author: .[0].author, totalpages: ( map(.pages) | add ), books: ( map( { title, year } ) ) })'