Copyright for lectures, slides and textbook: university or professor?
This answer is about the US only. United States copyright law has a concept called "work for hire." The copyright of a work for hire belongs to the employer, if the work fits in one of the following categories:


  1) a work prepared by an employee within the scope of his or her employment; or (2) a work specially ordered or commissioned for use as a contribution to a collective work, as a part of a motion picture or other audiovisual work, as a translation, as a supplementary work, as a compilation, as an instructional text, as a test, as answer material for a test, or as an atlas, if the parties expressly agree in a written instrument signed by them that the work shall be considered a work made for hire.


Materials such as lecture notes or scholarly papers have traditionally never been considered works for hire. This is sometimes referred to as the "teacher exception." For some history and explanation, see this AAUP page. There are a couple of legal precedents described in the same AAUP article, Weinstein v. University of Illinois and Hays v. Sony Corp. These court decisions say that materials like scholarly papers are not a "requirement or duty" of the job, and that a school doesn't "supervise its faculty" in writing this kind of thing. A later Supreme Court ruling in 1989,  Community for Non-Violence v. Reid, was not specifically about academic work, but is important because it changed the criteria that had been assumed in Weinstein. The 2006 case Bosch v Ball-Kell reaffirmed the teacher exception, but may have had a negative effect on teachers' rights because it held that fair use applied to lectures. The AAUP article also describes some good reasons why the school probably doesn't even want ownership of the copyright. It is not well positioned to benefit from ownership, and ownership could entangle it in legal disputes.

Many schools have policies in which they attempt to lay out what they consider to be a work for hire. These policies have little legal force, because under US law, work for hire is defined by the law. A work cannot be made into a work for hire by the unilateral declaration of an employer that it is so, and even an agreement between the employer and employee may have no legal effect. Usually a school's policies simply reads like a summary of the law and historical practices.

All of this was basically settled law for many decades, until distance education became a big thing. At that point, many schools started to envision an online course as a type of commodity that they could own and exploit, and they started to get more aggressive about trying to call online course materials works for hire.

But in general, any lectures, slides, textbooks, or scholarly articles you write belong to you and not your school, and this is true regardless of whether the school posts a policy on its web site claiming otherwise, and possibly even regardless of whether they get you to sign a contract stating otherwise. You are on the strongest ground if your work is not written to the school's specification and if the school never had any say over whether the result was OK.

Putting your byline or a copyright message on materials such as lecture slides has no real effect on anything. You own the copyright automatically as soon as an original, copyright-eligible work is written down, assuming it's not a work for hire. By modern copyright law, the only real purpose of a copyright notice is that if you have to sue an infringer, it makes it harder for them to make the defense that they didn't know the work was copyrighted -- but that's a flimsy defense in any case, since copyright is automatic these days.

If you want to prevent the university from using your materials under the fair use exception to copyright, an analysis of Bosch v Ball-Kell gives the following guidance:


  This case also suggests that publishing teaching materials, documented plans to use them in research or a textbook, or other demonstration of market value can give faculty greater control of their teaching materials if a dispute arises over them.