How does Internal Keychain exactly work? I understand that an internal keychain is used to receive a change of payment when I pay someone.

For example, I pay $20, but it costs $17, so I get $3.

But what I don't understand is how can there be a change? When I send 1 BTC to someone, how does the receiving end determine that I overpaid by 0.9 BTC and send that back to me?
Bitcoin does not have the concept of account balance. It works on consuming the bitcoins that you have earnt in prior transactions. However, you cannot consume partial amounts. So according to your example, when you are creating a new transaction, in the inputs you will reference the transaction where you earnt the 1 BTC (it may be a single transaction where you got your 1 BTC, or you might reference multiple transactions whose values all add up to 1 BTC) and consume it entirely. Now in the outputs, you will send 0.1 BTC to address A and say 0.895 BTC to your change address. The difference of 0.005 BTC will go as mining fees.