Is one allowed to travel back to one's country of origin using a valid passport issued by the consular office in the US? Would that trigger detention in the airport?
Overstayed over 2 decades and have a clean record.
There are 2 aspects:
The US doesn't formally have exit controls, so no agency is systematically checking exit documents. Even if a CBP officer did spot-check you, they'd go "My job is to get you to leave. Since you're leaving on your own, can I carry your bags for you? Guide you to your gate?"
Retribution isn't coming. What is coming, is future refusal when you try to re-enter the USA as a temporary visitor. Because you'll have a 10-year ban, and after that, you will have difficulty convincing them that your next visit will be temporary.
Today, they just want you to leave.
As far as the airline boarding -- If you are a citizen of country X, you are entitled to travel there. You need to show the airline proper proof of that, becuase they have a legal obligation not to fly you somewhere you'll be refused. Your passport issued by that country will suffice. Of course, beware of situations where you select a route through a third country and they want a transit visa or something.
Yes, you are allowed to exit US, both legally (there is no law which would prevent you from leaving) and technically - unlike most other countries, there are no immigration checks when you leave the country.
Departing US after being in US illegally for more than 1 year triggers an automatic 10-years re-entry ban, however, the duration of the ban is only important for certain type of visas (mostly immigrant ones). A non-immigrant visa is unlikely to ever be granted to such a person even after formal ban expires.
Technically, it's departing the US after accruing 1 year of "unlawful presence". One could have "overstayed", without accruing "unlawful presence", depending on what status they entered on and other circumstances.