Each state has different rules. For one example Illinois doesn't tax remote workers of companies in Illinois who don't live in Illinois.
The nexus is "where the work is performed" or "where the employee resides" and usually states have agreements with the neighboring states so it balances out.
https://www.njspotlightnews.org/2022/09/nj-remote-workers-ny...