This should be specified as part of the deal. You should state in the contracted agreement from the start who has the rights to the finished project.
This should be spelled out in the contract. I've worked for companies where in the contract the client only owns a compiled version of the application not the uncompiled code. Typically for a website the design belongs to the client but as for the actual code, in most cases it is not possible to give full rights to the client. In my case, I use microsoft products for my programs, much of the code is prewriten classes by visual studio, not hand written, and as such is owned by Microsoft not me. Of the hand written code much of it is very similar from one application to the next (database entry etc) so the only truly original part is the is the concept of the site and the design I give my clients access to the uncomplied code, but not exclusive rights to the code itself, Only the design and original concepts.
Thats correct, though usually it would be the person paying's ownership if he paid for it to be unique.
If they pay you to provide a service, they have every right to assume complete ownership of the project. The fact that they are hiring you to write it is spelled out enough.