Why Palpatine Knew it was the Perfect Time to KILL Plagueis

In Star Wars, one of the most haunting and mysterious tales, was the tragedy of Darth Plagueis the Wise. How did Palpatine know it was the perfect time for him to kill his master? How did he know he has learned all of his secrets at that point?