The controller of target artifact sacrifices it, then reveals cards from the top of their library until they reveal an artifact card. That player puts that card onto the battlefield, then shuffles all other cards revealed this way into their library.
If the first card the player reveals is an artifact card, they will still have to shuffle their library even though no other cards were revealed this way.
If the targeted artifact is an illegal target by the time Shape Anew resolves, the spell doesn’t resolve. Nothing else happens.
If the targeted artifact’s controller can’t sacrifice it (due to Tajuru Preserver, perhaps), the other effects of the spell will still happen.
If there are no artifact cards in the player’s library, all the cards in that library are revealed, then the library is shuffled. (The targeted artifact remains sacrificed.)