State tax refunds are only taxable if it is a refund of state income tax money that you deducted from your income in a prior year.
If you received a refund check from a state in 2017 for your 2016 state tax return, then it is only taxable on your 2017 federal return if the following applies:
You itemized deductions on your 2016 federal return, and
You opted for the state income tax deduction and not the state sales tax deduction.
If both of those are true, then at least part of your refund must be added to your income on Line 10 of Form 1040 (or Line 11 of Form 1040NR). If not, you can ignore the state tax refund.
It doesn’t matter if you are a resident or not.
The reason your state tax refund would be taxable on your federal return is because you deducted your state taxes the previous year. You deducted all the state tax paid on your federal return, but then the state sent you some of that back, meaning that you deducted more than you really owed the state. The fed wants you to now pay tax on the amount that you ultimately did not pay in taxes to the state.
If you did not deduct your state tax payments from your federal return the previous year, then you have no reason to add your state refund check to your income, as you already paid tax on that money the previous year.