Can I unroot my phone My GPS is broken, and I want to replace it or have it repaired. Is there a way to unroot a samsung galaxy s 4G t-mobile back to the factory conditions?
As sparx said, depending on how you rooted, you can "unroot" with an app if you only rooted your device and did nothing else.

If you modified android, by say, removing some bloatware, or flashed another rom on your device, then you will need to use something like Kies, ODIN or Heimdall to flash back the stock ROM.

Flashing back the stock ROM can replace all traces of any software modification that you have done to the device. This can include the OS, boot, and kernel.

I have never used Kies so I can't speak about how good that works. Kies is the "official" update tool for the devices. 

I have used ODIN in the past. It is a samsung product, but it is basically a leaked software that is used internally.

Heimdall is an open source alternative to ODIN that works on other platforms besides windows. It uses the same protocols that ODIN uses.

If you do go any of the "flashing stock" routes, try to search for someone giving instructions exactly how to do it. The community is very large, and someone has already done it. If you look, you can find their step by step instructions that you can follow.