United Nations Convention against Corruption
The technical term for this is asset recovery. Since we're talking about different countries, this is something done through the UN. Specifically to this case, it's the United Nations Convention against Corruption, which is signed and ratified by most countries:
Legend: green: ratifiers, yellow: signatories, grey: others.
"World map with United Nations Convention against Corruption" by Kmusser / CC BY 3.0
Asset recovery in that convention
An introduction on asset recovery in that convention (quote from the UN Office on Drugs and Crime website):
In a major breakthrough, countries agreed on asset-recovery, which is stated explicitly as a fundamental principle of the Convention. This is a particularly important issue for many developing countries where high-level corruption has plundered the national wealth, and where resources are badly needed for reconstruction and the rehabilitation of societies under new governments. Reaching agreement on this chapter has involved intensive negotiations, as the needs of countries seeking the illicit assets had to be reconciled with the legal and procedural safeguards of the countries whose assistance is sought.
Several provisions specify how cooperation and assistance will be rendered. In particular, in the case of embezzlement of public funds, the confiscated property would be returned to the state requesting it; in the case of proceeds of any other offence covered by the Convention, the property would be returned providing the proof of ownership or recognition of the damage caused to a requesting state; in all other cases, priority consideration would be given to the return of confiscated property to the requesting state, to the return of such property to the prior legitimate owners or to compensation of the victims.
Effective asset-recovery provisions will support the efforts of countries to redress the worst effects of corruption while sending at the same time, a message to corrupt officials that there will be no place to hide their illicit assets. Accordingly, article 51 provides for the return of assets to countries of origin as a fundamental principle of this Convention. Article 43 obliges state parties to extend the widest possible cooperation to each other in the investigation and prosecution of offences defined in the Convention. With regard to asset recovery in particular, the article provides inter alia that "In matters of international cooperation, whenever dual criminality is considered a requirement, it shall be deemed fulfilled irrespective of whether the laws of the requested State Party place the offence within the same category of offence or denominate the offence by the same terminology as the requesting State Party, if the conduct underlying the offence for which assistance is sought is a criminal offence under the laws of both States Parties"
You can read the specifics of that treaty here in chapter V. Rather than going through such general treaty law, I'll focus on this Swiss case.
Swiss International Mutual Assistance in Criminal Matters
The Swiss have an extensive document outlining principles on this matter (asset recovery and more) in a neat PDF. Many other countries do too, see this overview by UNODC.
In section 3.5 of the Swiss guidelines, handing over assets is discussed. For a good overview, I suggest reading the entire section as they are guidelines which do not require much legal background.
Handing over assets
In this case, we're interested in subsection 3.5.4 which includes handovers for the purpose of restitution and 3.5.5 which is about the division of forfeited assets.
In such circumstances, what do the Swiss authorities do with it? Do they hold on to it until they decide someone honest is in charge in Equatorial Guinea, and then return it to the relevant authorities there?
The procedure is rather extensive, and may differ on a case-by-case basis. Subsubsection 126.96.36.199 preliminary remarks is so relevant, it even mentions the gist of your question:
The problems associated with handing over
assets became particularly explosive in cases in which the assets in question were held
on behalf of a (former) head of state or one of his associates
Further in that subsubsection, the following is emphasised:
The judge examining the mutual assistance case may generally exercise considerable
discretion in deciding whether and on what terms a handover may be ordered.
Where the conditions for a handover are not met, the requesting state may, for example, be pointed in the direction of a civil suit. However, wherever possible, assets
should be handed over pursuant to Art. 74a IMAC, which is the fastest and most costeffective way for the requesting state.
As for procedure, subsubsection 188.8.131.52 reads:
As a rule, the handover of assets is the subject of a separate request from the requesting
state after it has received, in particular, the banking information that allows it to order the
forfeiture of the disputed assets.
The obligation to complete proceedings promptly nonetheless means that the requesting state cannot wait too long to order forfeiture, otherwise
the assets that had been seized would have to be released. Whether or not assets have
been held for an excessively long period is decided on a case-by-case basis.
Occasionally, the requesting state may be set a deadline by which it must order forfeiture, the consequence of not complying with the deadline being the release of the assets that had
previously been seized.
Sharing forfeited assets
This is the next subsection which applies when assets are forfeited and go to the state. The general description is as follows:
In accordance with a precept that originated
from the United States, it has since become accepted that the comprehensive review of
cases with an international dimension should be a matter for one of the states concerned
alone. Sharing seized assets allows the other states involved in the case to take a portion of the assets that have been confiscated. This encourages international cooperation
because all of the states involved in the procedure for forfeiture of the proceeds of crime
receive a share.
I think that this only applies if there are assets left after the case is concluded and no more assets need handing over for providing evidence or as restitution. Instead, its aim is to provide other states with an incentive to participate in investigations.