Under normal circumstances, the following formula applies:
A is the current Speed of the player's active Pokémon,
B is the opposing Pokémon's Speed divided by 4, mod 256, and
C is the number of times the player has tried to escape during the battle (counting the current attempt).
If F is greater than 255, the player escapes automatically. Otherwise, a random number is generated between 0 and 255. If that number is less than F, the player escapes. If not, the escape fails and the player's Pokémon does not make a move that turn.
In double battles you obviously have 2 Pokemon out but you only need to select "run" once, so it uses the speed of the Pokemon with which you select the "run" option.
As for what speed it uses for the opposing Pokemon, it is most likely the speed of the faster Pokemon or the average of both their speeds.
It doesn't say anywhere what it actually is but these are the most possible and logical possibilities.
Hope I helped.