How does Ripple ensure that transactions take place I am struggling with some concepts in the Ripple system. 

As I understand it:

After an American user goes to  a gateway and loads $ into the Ripple system that he wants to send to Cambodia, the money will be sent through the Ripple Network by modifying the accounts of ripple users between the sender and the receiver of the money. At the point it reaches the Cambodian, if he wants to access the real world fiat money, he will go to another Gateway and redeem the money so long as they have a store of $. 

The questions that I have are:

How do individuals set who they 'trust' to ensure that accounts remain active and the flow of debts remains valid?

How does the system respond if a user goes bankrupt and becomes unable to pay any debts that he has? 

What happens in the situation where there is no line between the sender and the receiver of money or where there is no Gateway that the receiver can use to redeem money?
How do individuals set who they 'trust'


Not sure what this means; each individual decides on his own who to trust. For example, I already (in a general sense) trust Bitstamp if I have USD or BTC deposits with them. Ripple just allows you to make this trust explicit in an open ledger. The meaning of this trust is, if I specify a trust level of $100, that the system will allow me to hold up to $100 of Bitstamp IOUs.


  How does the system respond if a user goes bankrupt


The system doesn't respond at all, as it merely keeps track of the IOU amounts - it does not, and cannot, enforce these claims. If one is willing to hold the IOU, it's probably because they believe it represents a claim that's enforceable in a court of law.


  What happens in the situation where there is no line between the sender and the receiver of money


Where there is no trust line, a transfer is not possible at all. If finding a trust path is difficult, one option is for them to offer liquidity in XRP - the only Ripple asset without counterparty risk. Then anyone who, on his own end, has path access to XRP will be able to send funds - the XRP acts as the 'trustless' bridge or vehicle currency.

Note that this is the role played by bitcoin in many situations today; for example bitcoin is used as a vehicle currency in various remittance models, and is able to offer advantages precisely because of its low trust requirements. 

In the end, XRP and BTC will compete for liquidity; whoever has the higher liquidity will have the lower costs.