U.S. citizen operating a foreign corp abroad - how to set up in US?
Only U.S. citizens or permanent residents may register an S-Corp, so really an LLC would be the best option as opposed to your other option of registering a C-Corp (although C-Corp can be useful in minimizing your overall tax exposure, see that answer from our tax expert).
You may list your company in Costa Rica as the owner of your U.S. business, and you do not need to have a U.S. address for the business. If your company is conducting it's business solely online, you have choice to register in any state. Typically, Wyoming or Delaware are the top preferred states due to their business-friendly atmospheres. You can click here to see a side-by-side comparison of Wyoming and Delaware.