Why isn't data lost when sent over large distances? I was thinking about how information is sent, for example through the atmosphere. There are plenty of obstacles, as well diffraction, etc.
Still, no information is lost.  How is information sent to allow this?
 A: Firstly, long wavelengths are used in the carrier waves. These are affected less by everyday matter, and are good at spreading out. They can reflect, but they aren't distorted or diffracted much. In contrast, light waves are absorbed everywhere, and X rays and higher are very directional.
That's all the physics involved. It's good enough for a radio to work. Fortunately the format of radio transmission is such that distortions in the carrier wave do not completely destroy the sound; they just fizz it up, since the sound wave is not encoded in any format but instead just sent raw on the carrier wave. If you sent an MP3 by the same method (with no CRC), even a tiny bit of "fuzz" would destroy the file.
Besides that, most data-transmission protocols have a lot of redundancy. The most common redundancy mechanism is CRC. Basically,  you first identify a function that gives unpredictable, fixed-length values -- small changes in the input lead to large changes in the output. There also is a very small chance of "collision" -- it is unlikely that any two given inputs will have the same output. Such functions are usually known as hash functions. Now, data is sent in chunks, and after every chunk is sent the hash of that chunk is computed and sent. If there were any errors in transmission, either in sending the chunk or the hash, then the receiving end will notice that the chunk and the hash do not match. It will then reject the chunk and ask for another copy (note that this requires a two-way transmission channel). This goes on until the full file is received and assembled.
A: This is a good question with a lot of deep math and physics behind it (information theory).  I will try to give you a casual answer.
Signal to noise ratio:
First, you should ask yourself what a "signal" is.  For example, when you listen to the radio, especially AM radio, you hear the sounds / music / voices just fine even though there is static / noise in the background.  What's happening is that your brain is able to "filter" out the static noise and interpret the intended audio.  If the audio you're supposed to hear is the signal and the static in the background is the noise, then what matters is the ratio in strength between those two.  If the noise is the same strength as the signal you'll mostly just hear static and you won't get much if any signal.
This ratio is known as the signal-to-noise ratio.
As a signal is transmitted, it gets weaker and lots of things modify it on the way.  You can think of those things as 1) weakening the signal and 2) strengthening the noise.  As long as the signal stays much stronger than the noise it will still be possible to recover it at great distances.
For example, the waveform above is perfect signal and the one below has lots of noise:

Notice it's still possible to make out the main signal because the ratio between the signal and noise is high.
Parity check and error correcting codes:
Sometimes when you transmit a signal there is enough distortion that some of the data doesn't arrive perfectly.  The general way to counteract this is with data redundancy.  For example, you could say everything twice.  This is very wasteful but it does an okay job of handling errors.  Other schemes include encoding every 8 bits as 10 bits.  There are many different types of error detection and correction codes that can be used.
Theoretical limits:
The ratio between the signal an the noise (as well as the total frequency bandwidth available) ultimately determines how much information can be encoded and still recovered later.  This is known as the Shannon-Hartley limit.  If you leave lots of "room for noise" then as a signal propagates long distances and gets weaker and noise increases, the signal will still be recoverable.
In practice:
There are lots of practical encoding schemes to try to pack as much information into a noisy channel as possible.  One of the really popular ones is QAM which gets used by cable Internet and wireless and all sorts of things.  Ultimately the quality of the link and the amount of information that can be transmitted is based on the signal to noise ratio and bandwidth.
Edit: I should say something about links and efforts to reduce noise.
Noise reduction strategies:
Every type of transmission medium is susceptible to distortion and noise and there are many strategies for trying to reduce that so that the signal can go farther and still be recovered.
In wireless transmissions, noise and distortion are often at a single frequency and one strategy for reducing this is to spread out the signal's spectrum so that it covers lots of different frequencies.  This is called spread spectrum.  There are many variations on this including "frequency hopping".
In fiber transmissions, the light down the fiber may not take the shortest path.  For a given pulse, some photons may be reflected many times and others may take a nearly direct path.  The longer the fiber is the more the signal spreads out.  This is called "modal dispersion".  By narrowing the diameter of the fiber and playing neat tricks with the index of refraction it can be mitigated to some degree.  Here is an image showing this:

See http://www.photonics.com/Article.aspx?AID=25153 for more details.
For wired transmissions an effort is usually made to add shielding to the wires or balance the pairs (and twist them) to reduce cross-talk.
