When a sender creates a transaction, they explicitly define which pieces of bitcoin they spend. We call such pieces of bitcoin Unspent Transaction Outputs (UTXO) and you can think of the UTXO Set as the distributed ledger of Bitcoin's balances. The state of UTXO is ternary: they either don't exist yet, are available for spending, or have been spent. So, you can't deduct from them, but must spend them completely in one transaction.
Spenders explicitly pick the transaction inputs by referencing the UTXO via its unique outpoint
txid:vout which is derived from the transaction that created the to-be-spent UTXO. Now the spender essentially has assignable balance to the sum of the inputs' total value. The spender will explicitly assign the value of the consumed inputs to new outputs. Any funds not assigned are considered transaction fees and will be collectable by the miner that includes the transaction in a block.
This means the following hold true for (non-coinbase) transactions:
Σ(outputs) ≤ Σ(inputs)
transaction fees = Σ(inputs) - Σ(outputs)
So, to be clear, only the inputs and outputs on transactions are explicitly defined. The transaction fee is implicitly defined by the inputs and output.
It follows that a simple transaction sending to a single recipient will generally have two outputs:
- a recipient output to conduct the payment
- a change output to return the remaining funds from the inputs to the sender
I grabbed a random transaction from blockchair.com to visualize:
If Alice's wallet had not created the change output to itself, Alice would have paid 11,044.… BTC in additional fees. ;)
Note, that I'm simply guessing that the 610 BTC is the recipient output due to the round number, I'm not intimately familiar with this transaction.