I won't even start correcting the post directly above me, been there and done that too many times with others, yet I'll summarize it for you.
This is all based of assumption and research but one part will never be proved as we don't have Jagex their source code, there are two aspects to this entire story:
One, The RS server (up to revision 570-570'ish, this doesn't apply in clients with GPI updating and on) handles its players in some form of collection where it loops through to when creating the update package in order. You login and you will receive the first empty spot in the collection, this can be 1'st, this can be 1000'th etc. Being earlier in the collection will get your player's actions processed first, which is believed to possibly create a gain over the other in interaction (in this case, staking) but there has never been hard prove for this.
Two, your internet connection. Data over the internet travels with a limited speed, based on overhead in your router, based on overhead in your computer, based on overhead on the link between two connected nodes etc etc. Obviously, if your connection with the RS server is better than your opponent's, chances are that your data will arrive at the server earlier. This still doesn't give an advantage, unless the following happens: the connection from the opponent is that much slower that it arrives at the server end that much later that it gets processed one server tick cycle later (their server ticks at 600ms). In that case, you see a difference between animations, one player being attacking the other a tad bit earlier giving the advantage.
The story about IP's, in all honesty and no offence, is completely wrong. Also, PID = player index.