Because the library is a hidden zone, you can search and fail to find even if there are legal targets in your library. So in this example you would search and not find anything and then shuffle. Your opponent cannot ask to see your library.
This is only true if you are getting a card with a specific property (a land, a creature, a snail with converted mana cost 7 or greater, etc.). If the card is like Demonic Tutor and simply says 'search your library for a card', you have to find something.
In this case, however, the fetchlands are looking for a card with specific properties (land card with a given basic land type), so you can fail to find.