I don't feel as much like an expert on this topic, but first I'd say give them plenty of notice. Two weeks is, of course, standard and sufficient, but if there's some event or project they really feel like they need you for, you might consider staying for that IF it doesn't interfere with your new job or your job search. If they want you to stay for another two months, you'll have to negotiate what feels comfortable for everyone concerned. I once had a boss, let's call him Danny, who did NOT want to let me go. He actually tried to get me to stay for weeks and weeks longer than I wanted to. I finally had to be firm with him and accept that Danny just wouldn't be an ally in the future.
At work, don't talk disparagingly about your job even if you're sick of it. Any of your co-workers could be valuable references or resources in your future job search efforts. If you criticize the job or company, it could make them feel bad about their position or their choice to stay. I've made this mistake before.
Regarding the sneaking around you have to do in order to find a new job, I don't know what to say. Does anyone have any suggestions? Danny let me know that he took my leaving his company very personally and he seemed hurt that I had lied about taking a long lunch hour so that I could interview. But I doubt that's typical. Maybe someone else has a good suggestion.
Any other advice anyone can add?
(today I am exactly 39 and a half years old. I'm the only person I know who recognizes her half birthday)