Is your employer on the tax form written as the UN?
There is no tax form.
Which country do you pay tax to?
If you're a US national or permanent resident, you pay tax to the United States. You report the income as does a self-employed individual. Because the US is the only country in the world that taxes UN employees, the UN reimburses you for the tax so your compensation is comparable to that of its employees who don't have to pay tax to the US.
If you are not a US national or permanent resident, you are exempt from income and payroll taxation even if you work in the US.
Is it treated like a corporation?
No.
If you're an employee of the UN, and for some reason the UN decided that it's just not going to pay your salary, what can you do?
You can pursue your claim through the UN's internal justice system.
As far as I know the UN has legal immunity, so... In that situation would you have no legal recourse?
Beyond the UN's internal system, no, there is no recourse.