From a comment you made to the original question:
If the W2 shows the new address how does the IRS know you've been in
New York state and a few others are aggressive regarding state income taxes. Any connection to their state and they will tax the income. Plus the IRS only cares about the lines on the W-2 related to federal income, and federal taxes withheld. They don't care about the actual states listed in the state section.
Let's say you have a work-from-home job with a NYC-based company. You
are a NY resident and you live in NYC. One month into the job you
decide (your choice) to change your state and go to Seattle and become
a WA resident. The company does not have an office in WA.
From the point of view of New York state all the income from before you execute the move is NY sourced income, so they will tax it. But because the move wasn't for work, they will also want to tax the income after you move because the company is in New York.
Going forward with this question lets just call the states State A and State B. Neither is aggressive regarding income, they have reciprocity and it only depends on where you live. None of this is true about the states in your actual question.
You notify the company of your address change. I am assuming the new
address is what gets listed on your W2 and as far as the IRS is
concerned, you are a WA resident.
The thing to remember the address on the W-2 only is used to mail the form to you. Now most people get it emailed, or download it from a company or payroll website, but the address is only the mailing address that you have in the January after the tax year ends.
The W-2 reflects how the company processed each paycheck, and how much was withheld and sent to the Federal government, State Tax authority A, and State Tax authority B. The W-2 can actually show income and withholding from Multiple states just in case you move during the year.
So if you get paid every two weeks and the first 6 checks were when you lived in state A, and the last 20 checks were when you lived in state B, but you were slow to tell HR about the move by changing your state W-4 from state A to state B until 5 more checks had been processed; then the W-2 will show funds were withheld at an 11 to 15 split instead of 6 to 20. This means that you should get a refund from state A and owe more money to state B.
Will you be paid back the NY state tax when you file your taxes the
Keeping with generic states: You will be filing 3 income tax returns: Federal, state A and state B. That is where you settle up between the numbers on the W-2 and the reality of your situation. The W-4 only reflects how those checks were processed, not how the income and withholding should have been allocated.
But Because New York is aggressive, and Washington state doesn't have any income tax, New York state will be taxing all the income.