Chancellor Palpatine is, as I say, one shrewd cat.

As Darth Sidious he convinces the Trade Federation to blockade his home planet Naboo over a taxation issue and eventually occupy it militarily. He expects Queen Amidala to sign a treaty legitimizing the Trade Federation's occupation and cast doubt on Chancellor Valorum's leadership.

But it doesn't quite go that way

Valorum sends two Jedi to settle the dispute. This doesn't sit well with Sidious who moves the invasion plans along before they have a legitimate excuse. Ignoring the Trade Federation's attempts to kill them, they make their way down to Naboo and take Queen Amidala to safety.

This is Really not sitting well with Sidious now, so he sends his apprentice Darth Maul to track them down. Maul tracks them to down, but fails to capture the Queen. The group escapes to Coruscant to meet with Senator Palpatine and ask the Senate for help.

Suddenly, things are looking up for Palpatine. He convinces her that Chancellor Valorum cannot help Naboo and that her only options are the courts or a vote of no confidence in Valorum's abilities. She opts for the latter and sets Palpatine on the way to becoming Chancellor. The sympathy vote generated by his situation is enough to get him elected.