With Ripple, how do Gateway IOUs work? A Gateway must do two things
  
  
  accept some form of deposit from a user and give the user Gateway
  IOUs. (Other -> ripple) 
  accept Gateway IOUs from a user and send that
  user payment. (ripple -> Other)
  


How does Gateway IOUs work? I have three basic questions:


Which one happens first in a gateway, (a) users pay money to gateway, or (b) gateways transfer IOUs to user? What guarantees that step 2 happens?
What will happen when a gateway refuses to accept IOUs, and transfer money back to user?
Is there anything similar to 'interest rate' for holding IOUs for long time?
which one happens first in a gateway, (a) users pay money to gateway, or (b) gateways transfer IOUs to user? what guaranties step 2 happens?


The gateway gets to set its own policies. However, the general consensus is that gateways should avoid risk because they'd have to pass losses onto their customers in the form of higher fees. So you probably shouldn't trust a gateway that extends IOUs to people whose money it doesn't hold.

If the gateway breaches its contract with you, you should complain publicly, sue them, or take whatever action you consider appropriate. Gateways are only worth their reputations.


  what will happen when a gateway refuses to accept IOUs, and transfer money back to user?


The user can just exchange the IOU for another IOU at a gateway that will do business with them. A gateway can't can't really refuse to redeem IOUs for one user specifically because the IOUs are tradeable and fungible. Once at least one outbound Bitcoin gateway is running, you could exchange the IOU for Bitcoins.

If a gateway begins reneging on its redemption agreements generally, then the value of those IOUs will fall and people will stop accepting them. This is the counter-party risk you take when you extend trust in the Ripple system. Using Ripple as a store of value for fiat currencies requires reliable gateways. There's no getting around this.


  is there anything similar to 'interest rate' exists for holding IOUs for long time?


No. Once interest rates increase from their current near-zero level, this could be a major profit center for gateways. Of course, if being a gateway is very profitable, lots of companies will do it and then competition will either drive down rates or drive up services. (Remember when banks gave away toasters?) Nothing stops a gateway from giving rewards to people who hold their IOUs.