Although this may vary from country to country, in Canada, everything you write is legally yours. You own the copyright to everything you create.
The copyright remains yours, and part of your estate, until 50 years after you die. You don’t have to do anything.
Unless you sell it. (Basically, when a publisher offers you a contract, they are ‘buying first rights,’ or ‘renting’ your work from you. There are a zillion variations on what rights you can negotiate – second prints, paperbacks, reprints, movies, etc. – but you start with selling first rights. Once the publisher has fulfilled their contractual obligations – they’ve used up all their rights – the full copyright reverts back to you. The only way all of this matters to you prior to being published is if you send your work out to more than one publisher at a time – in general they don’t like that, and you must tell them if you do.)
Other than that, make sure you get some sound legal advice before signing any contract affecting your work. Protect yourself, but be prepared to negotiate. A professional will be able to explain your options and obligations.