As a general rule people who are moving abroad for more than a year have to deregister at the Residents' Registration Office (Einwohneramt) - practice and legislation however varies in the different cantons. Inquire at your Residents' Registration Office about requirements and possibilities. At the same time you should clarify how and when to finalise the tax return for the running year.
If you have the option to stay registered, consider the advantages and disadvantages in your individual case. Deregistration means it is no longer possible to remain on the compulsory basic health insurance scheme, thus you have to seek a new health insurance cover. There are also other consequences to consider (cover for other insurance like home and contents insurance, liability insurance etc.).
On request the residents' registration office may give you a confirmation of your deregistration in advance. This enables you to prepare cancellation of contracts where a proof of moving abroad is required to avoid costs (e.g. mobile phone provider).