I recently re-watched parts of the Phantom Menace and it doesn't seem clear to me whether or not Palpatine planned for the counter-insurgency to be successful on Naboo. Darth Maul's unsuccessful attempt to counter the Jedi on Naboo and elsewhere, allowed the Jedi to learn of the return of the Sith and to be alert for danger from them.
Obviously it wasn't a big set back for Palpatine since he really only needed to create the threat of the Trade Federation to justify the creation of the clone army.
Is there any mention in the script or novelization of Palpatine's original plan, or did he foresee Darth Maul's death anyway?