How do exchanges automatically forward deposited bitcoin?
Generally, the exchange will use a full node that is continuously checking the network for received transactions. Once it detects a transaction has been made to your deposit address it waits for the transaction to be confirmed, then it will credit you the balance. This data is stored in a private database managed by the exchange where they keep track of each user's balance. The bitcoins you deposited are then either pooled to pay for someone else's withdrawals or sent to a cold wallet (an air-gapped device that is not connected to internet) where they are stored securely if they're not going to be used in the near future.