Double-Entry Accounting System
The primary reason that the balance sheet balances is the double-entry accounting system, which has evolved over hundreds of years from simple T accounts used in medieval Italy. For every entry, a balancing entry is made, preserving the balance. The basis for this system is that assets are recorded at their historical cost basis -- the price for which they were purchased -- meaning increases in market value are not reflected on the balance sheet. Besides financing activities, only earnings or losses affect shareholders' equity, and earnings or losses are balanced by the increases or decreases in assets and liabilities that generated them.
Cash Inflow and Outflows
Understanding the nature of cash inflows and outflows helps to shed light on the perpetually balanced nature of the balance sheet. An increase in assets represents an outflow of cash. For example, if inventory increases, it is because a cash expenditure is made to purchase the inventory. The increase in inventory is offset by the decrease in cash. Both inventory and cash are assets, so the two wash out, having no impact on the balance with liabilities and equity. Similarly, an increase in liabilities reflects an inflow of cash. For example, debt is a liability. If you record new debt to the balance sheet, this reflects a corresponding increase in borrowed cash. In this case, assets (cash) increase the same amount as liabilities (debt).
Net earnings, which reflect revenues minus expenses, flow through the shareholders' equity portion of the balance sheet. In modern accounting, revenues and expenses are often recognized when they are measurable and a transaction occurs, as opposed to solely when cash is exchanged. This is the basis for the accrual system of accounting. If a company knows it will pay $10 in one month, it can record an accrued expense today of $10 and also an accrued liability of $10. The expense flows through to lower net earnings and, therefore, to shareholders' equity. This is offset by the increase in liabilities. The balance against total assets is preserved.
Think of a company on the day of its formation. The first journal entry would be from issuing capital stock. Assume $100 of stock is issued. Also assume a bank extends to the company a $100 line of credit. This results in $200 of liabilities and equity -- $100 in debt and $100 in shareholders' equity. Balancing against this is $200 in cash that is generated by these financing activities. Cash is an asset. This is a simplified example, but liabilities and equity fund asset growth, and the corresponding journal entries balance.