You pay
taxes anywhere where you physically work essentially, there are many threads on here that cover the subject in depth.
You cannot be self-employed/have your own company and work for that company in the US because the sponsor would have to be your company and TN-1 sponsorship has to be arm's length. Doesn't matter how complex you make the relationship or who owns the shares etc. it boils down to if you exert control over the sponsor. If you do, you can't get TN-1.
However having said that for US employers with one-off Canadians working for them the simplest set up (by a very long distance) is for you to be self-employed in Canada and invoice them for the work you do there and do all the payroll withholding like CPP and income taxes yourself; and on the US end you are directly employed by them, they sponsor you for TN-1 (or whatever) and you get a W-2 from them.
This means they don't have to have a Canadian payroll and you don't need a US payroll so it keeps it simple. Neither one of you wants to get into a situation where you're doing foreign payroll, it's hideously complex especially if you're using corporations. The only reason to do it some other way is if they have a Canadian office and you can go on that payroll for the work you do in Canada.
You declare the income from the W-2 on your T1 and claim a foreign tax credit using T2209 and T2036, and you also have to file a 1040NR in the US to report the W-2 income to the IRS (and possibly an 8840 or an 8833 depending on how long you're there).
If you decide to use a CCPC rather than being self-employed, bear in mind that if you ever move to the US permanently (or move your tax home there) then your CCPC becomes subject to departure tax which seems to catch a lot of people out based on the posts I've read on here.
Steve.