The infiltration chance is determined by adding up the total number of Subterfuge points of spies and assassins in the city, and comparing them to the number of Subterfuge points the infiltrating spy has, plus that of any spies you may already have gotten in there.
The reason you see spies "kicked out" is that there is both a chance for spies to be discovered, but escape the city safely, and a chance they are discovered and caught, then executed by the enemy. HTH.
Bookmarks