How does TDS work during a home purchase — especially if the seller is an NRI?

Trying to wrap my head around this 1% TDS thing while buying a property - is this something I have to pay directly to the govt? Or does the bank handle it during disbursement?

Also curious - what happens if the seller is an NRI? Does the TDS rule change in that case?