I recently started the second chapter of mesechta Bava Metzia. It is called אלו מציאות which means these are the found objects. The subject matter is found objects which the finder may keep. The general doctrine is that if the loser of an object looses hope of finding it then the object is considered as abandoned property and the finder will acquire legal title to it. This doctrine is called ייאוש meaning dispair because the owned has dispaired of ever recovering this object. Its source in scripture is unclear and oblique. Nevertheless it is an important accepted principle. The example given is an item that falls into the sea or a river. It is assumed that the owned would dispair of ever getting it back. Therefore if it washes ashore the finder will legally own it.
In many cases the lost object has a sign that will allow the owner of it to identify it. In this case the finder typically must make an effort to return it. The idiom used is להכריז, to announce, meaning the finder must make an announcement in the hopes that the owner will come forward. This is based on the verse, "וְכֵ֣ן תַּעֲשֶׂ֗ה לְכׇל־אֲבֵדַ֥ת אָחִ֛יךָ אֲשֶׁר־תֹּאבַ֥ד מִמֶּ֖נּוּ וּמְצָאתָ֑הּ". "And so shall you do with any lost article of your brother which he has lost and you have found", (Deuteronomy 22:3). From the word מִמֶּ֖נּוּ (which he has lost) the Gemara imputes the idea that the lost object has a means of identification. After meditating on the phrase "[the item] that was lost from him (אֲשֶׁר־תֹּאבַ֥ד מִמֶּ֖נּוּ), I didn't understand it that way. Rather it seems to be implying that the item has some value. It seems to me that there is not an obligation to return something of negligible value, say a paper clip, unless it's return is demanded. However one who goes through the trouble of returning it would be credited with performing a mitzvah.
My basic reading of the Chumash is that lost articles should be returned. Whether its owner has dispaired of getting it back seems to me to be irrelevant. However items of little value can be kept by the finder. The amount of trouble involved with holding onto an unclaimed object, including ones of value, seems to be important. If after a reasonable wait the item remains unclaimed the finder can treat it as if it is his own. In the case of money, this means that he can spend it. Perishables likewise may be consumed. If the owner should later show up, the finder has no obligation to make restitution. However if it's a durable item that can be returned without an expenditure by the finder, for example a piece of jewlery, it should be returned.