JailBreaking only affects the software, and restoring a JailBroken device to an official version of the iOS firmware will essentially make your phone "not JailBroken." Restoring the device simply means reinstalling iOS normally through iTunes by either selecting the "Update" or "Restore" button, and can be done to any device regardless of whether or not they are currently or have previously been JailBroken.
However, there have been a few cases where I have run into issues that made my device temporarily unusable (I honestly thought I had bricked my iPod). There was a slight difference in the way iOS 4.3.3 was exploited, and it made it difficult to restore. When you went into iTunes to restore, it would return you errors 1394, 2005, or 1601 (or a plethora of others) during the verification process (this is where iTunes checks with Apple to make sure you're using an official .ipsw (the actual firmware package)). It didn't matter if you were using a modified .ipsw or an official one, it would always fail. There were a few things that you had to try to fix it, and if you didn't do it right, you ended up with a different error code that you've never seen before. You had to either modify your hosts file (it associates IP addresses with domain names, so that iTunes was going to the right place to verify the install), put your device in "Pwned DFU" mode (it's a half-JailBroken state that doesn't require you to use an official .ipsw inside of iTunes) with iREB, or use redsn0w to install iOS for you. After having no luck with the other solutions, I ended up having to download the official iOS 5.0.1 firmware from Apple and then installing it with redsn0w. For the most part, redsn0w is for installing modified firmwares or for JailBreaking existing ones, but in this case, I had to use it to merely bypass iTunes's verification.
In conclusion, most devices will just be an easy one-click install for restoring iOS. Apple cannot tell if you've previously been JailBroken if you do a full restore. Doing a full restore means that you set it back to factory defaults. It erases everything including data in your /private/var/mobile/ profile. A standard update will not delete data here, because iTunes backs up your profile before it installs and then loads it back on when it's finished. Some JailBreak tweaks store their preferences in .plist files in /private/var/mobile/Library/Preferences/, so if Apple really wanted to see if you've been JailBroken before, they could check there for any files from unapproved apps/tweaks (so make sure you erase everyhing if you're worried about Apple knowing you JailBroke it). A full restore is done best with redsn0w, because I've had times where iTunes uses my backup data even when I clicked the "Restore" button.
There aren't any apps that I know of that leave a "mark" like you mentioned in a comment. There are some apps like Skype that yell at you if you're JailBroken, but the app still works. If you're still worried, a full restore would get rid of anything and everything on the device.
For the most part, and if you do it correctly, Apple cannot tell if your device has ever been JailBroken, so you'll be "supported by Apple" again.