I am currently working for a company on a contract-to-hire (eventually) plan. Apart from tax forms, I never signed an official contract. Do I maintain all rights to my work? I am by no means planning on walking away and calling it mine - just interested in reusing portions of it on other projects. Would that be acceptable?
This has bitten many people involved in work-for-hire situations.
I feel like this is kind-of a cop-out on an answer, but honestly, it depends a very great deal on what kind of work you're doing, and I think Harvard Law School's Professor Terry Fisher has already answered your question with incredibly elaborate detail in Lecture 6 (entitled, The Mechanics of Copyright; in 3 parts) of his universally available CopyrightX MOOC, so I'm just going to refer you there for now. There are several other examples of situations like the one you describe throughout the other lectures too, but I know he talks about work-for-hire situations in that lecture.
That is usually settled in a contract. For example, I do mostly open source development on LedgerSMB. My contracts state that my work is my own, but that I am willing to license them to the customer under any of the GPL v2, BSD, or MIT licenses, with the GPL v2 being the default.
I have also done work for Microsoft where the contract stipulated that they owned my work but licensed it back to me under the Microsoft Permissive License (very little difference except that the copyright statements say Microsoft). The first thing you need to do is figure out what is acceptable to you, as a business decision, and then decide what to do. However, I would recommend trying to retain copyright (and give them a non-exclusive license under terms they can live with) because it gives you better protection if you do something similar for another client and they then allege copyright infringement.
Again, I am not a lawyer, this is not legal advice, etc. It is probably something worth discussing with a qualified intellectual property lawyer, however, to help you come to a decision about what contract elements you are comfortable with in your specific business.
This is highly dependent on local jurisdiction, unless there is a contract governing the rights. The best practice is to have a lawyer draft up a boilerplate contract for you that specifies the rights in a way you are comfortable with and make sure they explain it to you so you understand the implications. Then if a client has questions about it or wants to make alterations, you understand what you are giving up if you remove a particular part of the contract.
Also, be aware that if you want to maintain rights to code you've written, it is also often necessary to have a solid NDA (non-disclosure agreement) that can help protect your clients' proprietary information and business processes that may be incorporated in the code. In those cases, you may have the rights to the code, but may not be able to reuse it without stripping out the portions that fall under NDA restrictions.