Wages are settled up to your last working day. Any economic compensation (if owed) is paid when the work handover is completed (Article 50 of the Labor Contract Law), and the employer must issue a departure certificate and transfer your social insurance within 15 days.
Nationwide (all cities)
The three-part settlement (Article 50)
Article 50 of the Labor Contract Law governs the settlement: when the labor contract is dissolved or terminated, the employer must issue a certificate of dissolution or termination, transfer the worker's file and social insurance relationship within 15 days, and pay the economic compensation at the time the work handover is completed. Wages are settled up to the last working day. So the settlement has three parts: (1) final wages — paid up to the last working day; (2) economic compensation — if you are entitled to it (see the compensation questions), it is paid at the completion of the work handover, not necessarily on the last day; and (3) the departure certificate and the social insurance / file transfer, which the employer must complete within 15 days.
Local variations
Shanghai caveat
The compensation entitlement itself turns on the reason for leaving (Article 46) and, for Shanghai foreign employees, on the employment contract. The Shanghai rule's 'follow the contract' caveat applies here too: the statutory obligation to pay compensation at handover applies where compensation is actually owed, which in Shanghai requires a contract clause.