The below was taken from the Olympics Charter :
42 Nationality of Competitors*
1. Any competitor in the Olympic Games must be a national of the country of the NOC which is entering such competitor.
2. All disputes relating to the determination of the country which a competitor may represent in the Olympic Games shall be resolved by the IOC Executive Board.
Olympic Charter In force as from 7 July 2007
Bye-law to Rule 42
1. A competitor who is a national of two or more countries at the same time may represent either one of them, as he may elect. However, after having represented one country in the Olympic Games, in continental or regional games or in world or regional championships recognised by the relevant IF, he may not represent another country unless he meets the conditions set forth in paragraph 2 below that apply to persons who have changed their nationality or acquired a new nationality.
2. A competitor who has represented one country in the Olympic Games, in continental or regional games or in world or regional championships recognised by the relevant IF, and who has changed his nationality or acquired a new nationality, may participate in the Olympic Games to represent his new country provided that at least three years have passed since the competitor last represented his former country. This period may be reduced or even cancelled, with the agreement of the NOCs and IF concerned, by the IOC Executive Board, which takes into account the circumstances of each case.
3. If an associated State, province or overseas department, a country or colony acquires independence, if a country becomes incorporated within another country by reason of a change of border, if a country merges with another country, or if a new NOC is recognised by the IOC, a competitor may continue to represent the country to which he belongs or belonged. However, he may, if he prefers, elect to represent his country or be entered in the Olympic Games by his new NOC if one exists. This particular choice may be made only once.
4. Furthermore, in all cases in which a competitor would be eligible to participate in the Olympic Games, either by representing another country than his or by having the choice as to the country which such competitor intends to represent, the IOC Executive Board may take all decisions of a general or individual nature with regard to issues resulting from nationality, citizenship, domicile or residence of any competitor, including the duration of any waiting period.
So we may see Michael Phelps swimming for Singapore in the next Olympics. Or maybe even the entire gymnastics team from China...