Advance rent is taxed when you receive it
If a tenant pays you rent ahead of time, a lump for the next several months or the year, that advance rent is taxable as income from house property in the year you receive it, not in the later years it actually relates to. So a year's rent taken upfront is taxed in that year, computed after the flat 30% standard deduction under Section 24 like any rent.
That is the mainstream and safe position, though it is worth knowing it rests on practice rather than an explicit advance-rent clause, and a genuine case for spreading it can occasionally be argued. For an NRI the timing has a direct consequence: because the advance rent is income when paid, the tenant must deduct TDS under Section 195 on it at that point, on the whole advance, not drip it over the months. So a large advance can carry a large withholding upfront, which you then reconcile on your return.
A refundable deposit is not income, and no notional interest
A security deposit is different in kind. A refundable deposit is not your income at all; it is money you hold and must return at the end of the tenancy, a liability, so it is not taxed when received, and no TDS applies to it because it is not a payment of income. It only becomes taxable if you later forfeit it, keep it because of a breach, in which case the forfeited amount is taxed as other income in the year you forfeit it.
There is a common fear that the tax office will add a notional interest on a large interest-free deposit, treating it as extra rent. In general it cannot: the courts, in cases like CIT v J.K. Investors, have held that the annual value is based on the actual or reasonably expected rent, and notional interest on an interest-free deposit is not automatically added. The one caveat is that an abnormally large deposit used to depress the rent can let the officer benchmark a higher fair rent from comparable properties, so a deposit far out of line with the rent is not a loophole. A practising CA taxes advance rent correctly, keeps a refundable deposit out of income, and defends the annual value where a large deposit is questioned.