So there are three paths to getting a marriage-based green card:
1. You do what's called consular processing out of the country;
2. You adjust status in the country; and
3. A fiance visa (K1). I'm going to ignore this.
For (1), your US citizen or green card holder spouse will wil an I130 visa petition to show that you're legally married. USCIS will confirm that you are legally married (including both of you being free to marry) and then it gets sent to NVC (National Visa Center) and you get documentarily qualified. This whole thing can take 6-9 months. It can take substantially longer if there are certain risk factors as far as USCIS is concerned for fraud. Large age gap, certain countries of origins (particularly the Phillipines), etc.
Once you are documentarily qualified, the foreign spouse will apply for an interview at a foreign consulate. This used to be anywhere but as per a recent rule change by this administration, now has to be the country of origin, meaning if you're Canadian you have to do it in Canada not the UK or Italy or whatever.
This may not seem like a big deal but the wait in some countries can be years long, just for the interview.
While this is all pending, you likely will be unable to visit the US because you've shown immigreant intent so you'll be denied ESTA or a visitor's visa most likely. Or, if you have a visitor's visa, you may be denied entry at the border.
For a standard case, this whole thing will take about 2 years. There are a whole bunch of steps like biometrics, police checks, etc and there are cases where you may need waivers of inadmissibility (eg if you have a 3 year bar or have a felony conviction). Those waivers can add years.
For (2), the process differs if you're marrying a green card holder or a US citizen.
If you have a marry a green card holder, they file an I130 petition and you'll get a priority date. There is a quota for these green cards. When your priority date becomes current, you the file an I485 for your spouse. Your immigrant spouse must've remained in status for this entire time up to and including when the I485 is approved. Because of the quota, this can take years and people will often become US citizens before the process is complete.
There is no quota for immediate relatives of US citizens (including spouses, parents and children under 18). If you marry a US citizen, you generally file the I130 and I485 concurrently. You can optionally also apply for advance parole, which will allow you to travel (more on that below), and an EAD, which will allow you to work until you get your green card. At this time people often get their green cards before their EADs so many don't even apply for them currently.
So, traveling. If you have a pending I485 and you leave the US you have in the eyes of USCIS abandoned that I485. You are now out of the country and most likely will be barred from re-entering the US, forcing you to consular process. You might be able to return if you have an immigrant intent visa like an H1B but it's generally recommended not to travel at all while you have a pending I485 application if you can possibly avoid it.
If you marry a US citizen, being out of status and working without authorization are both forgiven. This isn't the case for a marriage to a green card holder I believe. But if you marry a green card holder and while your application is pending they become a US citizen (as often happens), then the US citizen rules apply anyway.
So, if you are on a TN visa and have a pending I130 and I485, you have two choices:
1. You can leave the country and go back to Canada. This will abandon your I485 (but not the I130) and will force you to consular process. You'll be gone for 1-2 years most likely and likely unable to visit. This is the safest option however but obviously most people don't want to be separate from their spouse for so long, understanbly; or
2. You accept that you will be out of status and you stay. Any overstay of less than 6 months generally isn't an issue although working unauthorized is if, for some reason, your marriage petition is withdrawn or denied. If you overstay 6-12 months, you have an automatic 3 year bar on returning should you leave. If you overstay more than 1 year, it's a 10 year bar.
In the current administration, I think there are zero marriage petitions that should be done yourself. You should have a lawyer. Any decent lawyer who will be able to lay out the options as I've described.
Assuming your case is fairly straightforward and you've already filed the I130 and I485, I'd generally suggest people just accept the overstay and adjust in the US although I can certainly understand the "cleaner" (but longer) approach of choosing consular processing instead, particularly if you are still in status and don't have any automatic bar due to a 6+ month overstay.
1. You do what's called consular processing out of the country;
2. You adjust status in the country; and
3. A fiance visa (K1). I'm going to ignore this.
For (1), your US citizen or green card holder spouse will wil an I130 visa petition to show that you're legally married. USCIS will confirm that you are legally married (including both of you being free to marry) and then it gets sent to NVC (National Visa Center) and you get documentarily qualified. This whole thing can take 6-9 months. It can take substantially longer if there are certain risk factors as far as USCIS is concerned for fraud. Large age gap, certain countries of origins (particularly the Phillipines), etc.
Once you are documentarily qualified, the foreign spouse will apply for an interview at a foreign consulate. This used to be anywhere but as per a recent rule change by this administration, now has to be the country of origin, meaning if you're Canadian you have to do it in Canada not the UK or Italy or whatever.
This may not seem like a big deal but the wait in some countries can be years long, just for the interview.
While this is all pending, you likely will be unable to visit the US because you've shown immigreant intent so you'll be denied ESTA or a visitor's visa most likely. Or, if you have a visitor's visa, you may be denied entry at the border.
For a standard case, this whole thing will take about 2 years. There are a whole bunch of steps like biometrics, police checks, etc and there are cases where you may need waivers of inadmissibility (eg if you have a 3 year bar or have a felony conviction). Those waivers can add years.
For (2), the process differs if you're marrying a green card holder or a US citizen.
If you have a marry a green card holder, they file an I130 petition and you'll get a priority date. There is a quota for these green cards. When your priority date becomes current, you the file an I485 for your spouse. Your immigrant spouse must've remained in status for this entire time up to and including when the I485 is approved. Because of the quota, this can take years and people will often become US citizens before the process is complete.
There is no quota for immediate relatives of US citizens (including spouses, parents and children under 18). If you marry a US citizen, you generally file the I130 and I485 concurrently. You can optionally also apply for advance parole, which will allow you to travel (more on that below), and an EAD, which will allow you to work until you get your green card. At this time people often get their green cards before their EADs so many don't even apply for them currently.
So, traveling. If you have a pending I485 and you leave the US you have in the eyes of USCIS abandoned that I485. You are now out of the country and most likely will be barred from re-entering the US, forcing you to consular process. You might be able to return if you have an immigrant intent visa like an H1B but it's generally recommended not to travel at all while you have a pending I485 application if you can possibly avoid it.
If you marry a US citizen, being out of status and working without authorization are both forgiven. This isn't the case for a marriage to a green card holder I believe. But if you marry a green card holder and while your application is pending they become a US citizen (as often happens), then the US citizen rules apply anyway.
So, if you are on a TN visa and have a pending I130 and I485, you have two choices:
1. You can leave the country and go back to Canada. This will abandon your I485 (but not the I130) and will force you to consular process. You'll be gone for 1-2 years most likely and likely unable to visit. This is the safest option however but obviously most people don't want to be separate from their spouse for so long, understanbly; or
2. You accept that you will be out of status and you stay. Any overstay of less than 6 months generally isn't an issue although working unauthorized is if, for some reason, your marriage petition is withdrawn or denied. If you overstay 6-12 months, you have an automatic 3 year bar on returning should you leave. If you overstay more than 1 year, it's a 10 year bar.
In the current administration, I think there are zero marriage petitions that should be done yourself. You should have a lawyer. Any decent lawyer who will be able to lay out the options as I've described.
Assuming your case is fairly straightforward and you've already filed the I130 and I485, I'd generally suggest people just accept the overstay and adjust in the US although I can certainly understand the "cleaner" (but longer) approach of choosing consular processing instead, particularly if you are still in status and don't have any automatic bar due to a 6+ month overstay.