The gain follows the transfer, not the payment or the registration
Capital gain is taxed in the year the transfer takes place (Section 45), and transfer is a defined event (Section 2(47)), not simply the day the money cleared or the day the deed was stamped. So a sale that runs across two financial years does not give you a choice of year; it has one correct year, decided by when the transfer legally occurred.
For most straightforward sales, the transfer is the registration of the sale deed, and the whole gain is reported in that year even if part of the price was received earlier as an advance or later in instalments. The advance received in an earlier year is not itself taxed as gain, it is part of the consideration for the transfer that happens later. Getting this right matters because the TDS the buyer cut and the gain you report have to land in the same year, or the return throws up a mismatch.
When possession moves the transfer earlier, and when it does not
There is one situation where the transfer, and the tax, happen before registration. If you hand over possession of the property under an agreement to sell, in part performance of that contract, the law can treat the transfer as complete at that point (Section 2(47)(v)), even though the registered deed comes later.
The important condition, settled by the Supreme Court, is that this only applies where the agreement to sell is itself registered. An unregistered agreement, even with possession handed over, does not trigger the transfer, and the tax year then falls on the registered sale deed. So the question in a two-year sale is precise: was there a registered agreement with possession given, in which case the earlier year governs, or not, in which case the registration year does. This is exactly the kind of judgement where the wrong assumption produces the wrong year and a notice.
If the deal collapses and you keep the advance
Sometimes the sale does not complete and you forfeit the advance the buyer paid. For advances forfeited on or after 1 April 2014, that money is taxed on its own as income from other sources in the year you forfeit it (Section 56(2)(ix)), and it does not touch the cost of the property. Advances forfeited before that date followed an older rule that reduced the property's cost instead.
For an NRI this matters because the forfeited advance is Indian income in its own right and belongs on the return for the year of forfeiture, separate from any later sale of the same property. A practising CA maps which year each piece belongs to, the gain to the year of transfer and any forfeited advance to the year of forfeiture, so the filing is clean rather than bunched into the wrong year.