The tax follows the transfer, not the payments
The rule people find counter-intuitive is that capital gains is taxed by reference to the transfer, not the payment. Under Section 45 the gain arises in the year the property is transferred, and Section 48 charges it on the consideration received or accruing. The words or accruing are the key: the whole agreed price is treated as accruing at the transfer, so the entire gain is taxed in that year, even if the buyer will pay you over the next two or three.
So you cannot spread the gain over the instalment years to match the cash. And, importantly, if the buyer later defaults on an instalment, that does not give you any relief: capital gains has no equivalent of the bad-debt deduction that business income has, so a gain once taxed stays taxed even if part of the price never arrives. This is the cash-flow trap: the tax on the full gain can be payable long before you have collected the money to pay it with.
Unascertainable price, and the NRI timing
There is one situation the law treats differently. Where the consideration is genuinely not ascertainable at the time of transfer, a truly contingent earn-out with no fixed formula, Section 50D steps in and deems the fair market value on the date of transfer to be your sale consideration. That is a narrow rule: an instalment sale for a fixed price, or an earn-out with a determinable formula or cap, is ordinary accrued consideration and is taxed in full up front, not under this provision.
For an NRI the timing mismatch is sharper. The buyer must deduct TDS on each payment they make to you, so the withholding is spread across the instalments, but your capital-gains liability crystallises entirely in the year of sale. So you can face the full tax in year one while the TDS, and the money, only trickle in. The planning answer is usually a lower-deduction certificate and careful timing, and, where you can, structuring the sale and any reinvestment so the tax does not land before you can fund it. A practising CA fixes the year of charge, applies the right rule to a deferred or contingent price, and manages the TDS-versus-liability timing.