I just left a role. I wasn't really unhappy, I just hit a tenure that was long enough that it was time to go. 4-5 years if you're senior++ level is about right. I read the employee handbook, which asked for 2 weeks, and that's what I gave. I worked hard to transition and document everything I could. Never said anything bad about the company (I really didn't have anything to say), and I complemented and thanked my bosses.
Keep it classy, respectful, and professional - that's how a true boss quits.
This hasn't been my approach, nor has it been for many people I've worked with – or perhaps we're tripping over language?
Let's say that someone is super motivated by a high salary. They would be helping their manager (and, in most situations, themselves) if they were open about that. Up to and including conversations like "I hear that Company X is paying 20% more for a comparable role – here's some data to show I'm underpaid".
It's those kinds of conversations which would mean that your manager won't be surprised if in 6 months you leave for a better-paying role. Or, perhaps you get a nice pay rise. Or, if you can't have such conversations, see the red "you should leave anyway" box in the post!
In the work life, one needs to be strategic; it appears to me that most people on here who are commenting somewhat negatively about people giving 2-week notice and nothing else have never been laid off or fired or somewhat "mistreated" by a company.
The way to be an excellent employee is to always deliver work to the best of one's capabilities and give 2-week notice before leaving. In one company I worked for, somebody gave a 2-week notice and was let go immediately. It is not unheard of, and most legacy companies could not care less about a possible PR problem. Those legacy companies live in a galaxy that is far away from the one inhabited by start-ups and similar good PR-dependent companies, they are populated mostly by old dinosaurs that recruit heavily among the not-too-brilliant technical people.
That's situation-dependent: there's often stuff a company can do if you're highly cash-motivated (promotions, other title changes, bonuses, …) to retain you.
On the other hand, often there's not! Especially in older / larger orgs or ones with unconventionally rigid payscales. Even in that situation, I'd generally stand by the recommendation: there's a chance they will find a way to accommodate your needs, and if not you have cemented a strong relationship with your manager and above that will benefit you way into the future.
A few other commenters have mentioned the benefits they have realised by leaving gracefully. IMO this expected upside outweighs the short-term risk, at least in the sorts of roles the post is (now) aimed at.