In all these cases it is incumbent upon you to search for them to the extent of your means. If you find them, return them their right. If the owner or owners have died, then their right should be returned to their immediate kin. However, if you cannot locate them, then spend in charity equal amounts on their behalf. Allah will give them the reward of this charity. And if they are unbelievers, Allah will compensate them in some way or other in this world itself, since there are no rewards for the unbelievers in the Hereafter.
This is similar to the story that Ibn ul-Qayyim has written in his Madarij Al-Salikin (1/388). He states that a soldier of a Muslim regiment ghalla [i.e., stole from al-ghaneema (the war spoils)]. Then, after some time, he repented and took with him what he had stolen and reported to the commander of the regiment. But the commander refused to accept it back saying, 'And how do I return this to the soldiers [seeing that they have dispersed].' The man then went to a scholar - Hajjaj bin al-Sha'ir [seeking his advice]. He [Hajjaj] told him: 'Listen! Allah knows the army involved and each soldier's name and lineage. Send one fifth of the amount to the one whose right is one-fifth (this is in reference to bait ul-maal, or the central depository in the Islamic government which contains money to be spent in charity, and which receives one-fifth of all spoils of war), and spend the rest in charity in their name and Allah will give convey it to them.' The man did so. And when the news reached Mu'awiyya bin Sufyan [who was then the khalifa], he said: 'That I had been the man who gave that ruling, is dearer to me than half of what I rule over.' Imam Ibn Taymiyya has also given a similar ruling. (See Madarij)