When you said "as a result you have two outputs: The spent amount and the change", that is only one special case for Bitcoin transactions.
In a general Bitcoin transaction, here is what actually happens:
- One or more inputs, each with a valid signature, "dumps" coin value into the transaction.
- One or more outputs each "extracts" value from the transaction.
- Any remaining value (which must be zero or positive - but not negative) is considered to be a transaction fee for the miner to grab.
- (A special case of inputs is that the first transaction of each block is a coinbase transaction, and the single input is allowed to synthesize a certain amount of value from nothing.)
In light of this view, it should be clear that multiple outputs are allowed.
Let's illustrate with an example. Suppose some friends want do a transaction together because they want to share and save on the transaction fee:
- Alice dumps one input valued at 3 BTC into the transaction.
- Alice dumps another input valued at 2 BTC into the transaction.
- Bob dumps one input valued at 4 BTC into the transaction.
- Alice wants to pay Carol 2.5 BTC, so this is added as an output.
- Bob wants to pay Dave 3.99 BTC, so this is added as an output.
- Alice and Bob each agree to pay 0.01 BTC as a transaction fee.
- Bob needs no change.
- Alice needs 2.49 BTC in change, so this is added as an output.
- Input: +3.00 BTC (from Alice)
- Input: +2.00 BTC (from Alice)
- Input: +4.00 BTC (from Bob)
- Output: -2.50 BTC to Carol (payment)
- Output: -3.99 BTC to Dave (payment)
- Output: -2.49 BTC to Alice (change)
- Fee: -0.02 BTC to miner
- Final balance: 0.00 BTC (must always be zero)