Only Gold that you have purchased can be transferred to another account. Gold that you obtained any other way (from the Taskmaster, exchanging with Silver etc.) is not transferable. As well as this, you can only transfer Gold to an account on the same domain as you (from one .COM server to another .COM server).
To transfer your Gold before a server ends you must delete your account first. At the delete section on your account page (in game) it will tell you how much Gold you will be able to transfer. After your account has deleted completely (after 72 hours) an email will be sent to the address that your account is registered under.
If you have any Gold left over on your account when a server ends you will also receive an email.
This email will contain a link that you can use to transfer your Gold. If you click on the link you will see that you need to do two things; enter the username of the account you wish to transfer to and select the server they are on.
When the desired recipient is chosen they will get an IGM containing the option to accept the transfer. If the IGM is deleted before completing the transfer, the transfer link becomes invalid.
The transfer link that you receive is valid forever, until the Gold is transferred or if the IGM to accept it is deleted (as stated above). This means that it is possible to wait for a server to restart after it has ended, create a new account, and then transfer your Gold to the new account (as if you are carrying your Gold over from one server to the next).
If you have any problems when trying to transfer your Gold, please send an email to email@example.com with as much detail as possible.