Sending a text message internationally works the same as dialing a voice call: exit code - country code - national subscriber number. With most cell phones you can replace the exit code with the plus sign. For example, in order to text from Europe to the US you can either use 00 1 or +1 followed by the 10 digit US cell number.
Here's a list of country and exit codes.
Although wireless networks around the world may use different technologies to connect their subscribers, text messaging should work fine even when texting between two different types of networks (for example CDMA in the USA and GSM in Europe). So, if you encounter issues texting foreign cell phone numbers, in most cases there is a problem either with your wireless plan or with your phone. I have put together a list of possible reasons/fixes:
Again, texting and calling use the same dialing codes. Basically your phone becomes a local phone in the country you are traveling to for outgoing calls/texts, while for incoming calls nothing changes in the way people will reach you. See detailed info on how cell phones work while roaming in other countries.