Riku-Ansem is the form that Riku takes to capture Roxas, a mission requested by DiZ to help with Sora's awakening and restore his power. Roxas was overpowering Riku during their battle, but Riku was determined not to lose to the Nobody, so he removed his blindfold and revealed the dark power of Ansem that he had been hiding within him. He then succeeds in defeating Roxas and takes him to DiZ, and ultimately the Virtual Twilight Town.
Riku takes this form at the end of Kingdom Hearts 358/2 Days and continues to remain in this form throughout most of Kingdom Hearts II. In this form, he appears identical to Ansem, other than his clothing, and even refers to himself as a pseudo-Ansem. However, those who truly know Riku can sense him behind the appearance, as witnessed when Sora recognizes him in the Land of Dragons. In The World That Never Was, Naminé reveals Riku's true identity to Kairi, who then tells it to Sora, Donald, and Goofy.
Kingdom Hearts 358/2 Days
Riku takes this form at the end of Kingdom Hearts 358/2 Days when he is defeated by Roxas, Riku already knows that he will use this form, and Mickey made a promise to never tell Sora about what happened with Riku. In this form, he appears identical to Ansem, other than his clothing, and even refers to himself as a pseudo-Ansem. After Riku-Ansem defeats Roxas, Ansem the Wise appears and takes Roxas. After this, DiZ put Roxas into a Simulated Twilight Town, to continue the progress of Sora's awakening.
Kingdom Hearts II
Riku continues to remain in this form throughout most of Kingdom Hearts II. He helps DiZ awaken Sora and puts Naminé in line when she attempts to contact Roxas. When Roxas tries to enter the Old Mansion, several Nobodies appear, and Riku-Ansem hinders their progression.
He appears again in The Land of Dragons to alert them about the Storm Rider. Mulan is the first who saw Riku, and tries to catch him. Sora, Donald and Goofy arrive, and with Mulan, go to the Summit and find Riku. Sora confronts Riku but he escapes and goes to the Imperial Palace to talk with The Emperor. Riku-Ansem defeats Li Shang and talks about the Storm Rider. After this, he leaves the world.
Riku-Ansem appears again in The World That Never Was after Naminé helps Kairi to escape. Saïx appears and attempts to capture the two girls, but Riku arrives with his keyblade and confronts Saïx, who then escapes. Kairi discovers the truth about Riku through Naminé, and they go see Sora. In the Castle That Never Was several Shadows appear; Riku summons two Keyblades and hands one to Kairi. After Sora defeats Xigbar, he meets Kairi and Riku-Ansem. At first Sora believes that Riku is Xehanort's Heartless, but he discovers that Riku has taken the form of Xehanort's Heartless. Sora, Kairi, Riku, Donald and Goofy go to confront Xemnas, but first they defeat Saïx and Luxord. In Naught's Approach, Ansem's Kingdom Hearts Encoder explodes while attempting to turn Kingdom Hearts into data. Riku is transformed back into his normal form due to this incident.