Once you've got the basic tones of Mandarin pinned down (at least in understanding – fluent use takes much longer), you'll start to notice that they often change. When and where they change isn't random – there are specific rules that cause Mandarin tones to change in certain situations. These rules are called tone sandhi.
The number of tone change rules depends on how you count them. This post breaks them down as much as possible, covering four groups with six rules in total.
A symbolic notation is used as an alternative explanation for each rule, as some people find this helpful. In the notation, each syllable is contained in [ ], and numbers 1 to 4 indicate the tone of that syllable.
Rules for 3rd tone
It's actually unusual that a third tone will sound like the text-book falling-rising sound. If it's not in isolation, one of these two rules will cause it to change.
1. A 3rd tone followed by another 3rd tone becomes a 2nd tone
This might be confusing at first, so here it is phrased differently: when there are two third tones in a row, the first one changes to a second tone.
*As symbols: *
  ⇒  
你好 (hello): nǐhǎo ⇒ 'níhǎo'
很远 (very far): hěnyuǎn ⇒ 'hényuǎn'
好久 (a long time): hǎojiǔ ⇒ 'háojiǔ'
2. A 3rd tone becomes a 'low tone' if followed by any other tone
Again, this is confusing at first. It's probably easier to approach these two rules as "if a third tone isn't on its own, it changes". This 'low tone' is a low-pitch tone that falls slightly.
 [!3] ⇒ [low tone] [!3]
(here the ! represents 'not')
考试 (exam): kǎoshì ⇒ kao shì
语言 (language): yǔyán ⇒ yu yán
马车 (cart): mǎchē ⇒ ma chē
(In these examples, italics is used to represent 'low tone')
Rules for 一
The character 一 (one) is normally first tone (yī), but this changes in two situations. Note that these two rules for 一 do not apply when it is being read out as part of a figure (in which case it is always first tone).
3. 一 is 2nd tone when followed by a 4th tone
[一]  ⇒ [一2] 
一个 (one …): yī gè ⇒ 'yí gè'
一半 (one half): yī bàn ⇒ 'yí bàn'
一步 (one step): yī bù ⇒ 'yí bù'
4. 一 is 4th tone when followed by a 1st, 2nd or 3rd tone
[一] [1 | 2 | 3] ⇒ [一4] [1 | 2 | 3]
(here the | represents 'or')
一般 (normally): yībān ⇒ 'yìbān'
一直 (continuously): yīzhí ⇒ 'yìzhí'
一起 (together): yīqǐ ⇒ 'yìqǐ'
A rule for 不
不 is normally 4th tone (bù), but there is one situation where this changes.
5. 不 is 2nd tone when followed by a 4th tone
[不]  ⇒ [不2] 
不是 (is not): bù shì ⇒ 'bú shì'
不会 (will not, cannot): bù huì ⇒ 'bú huì'
不错 (not bad): bù cuò ⇒ 'bú cuò'
A rule for 2nd tone
There is one rule for second tone that is often omitted from textbooks, but is present in the speech of many native speakers. It's the most complicated rule and takes some getting used to. The rule is:
6. A 2nd tone preceded by a 1st or 2nd tone and followed by another tone becomes a 1st tone
This one will probably start to feel natural after a lot of listening practice and exposure. Written down, however, it looks fairly crazy.
[1 | 2]   ⇒ [1 | 2]  
(here the | represents 'or', and the * represents any tone)
三年级 (third grade): sān niánjí ⇒ 'sān niānjí'
谁来吃？ (who's coming to eat?): shéi lái chī? ⇒ shéi lāi chī?
特别难看 (especially ugly): tèbié nánkàn ⇒ tèbié nānkàn
Whilst it's good to make some effort to memorise these rules, also remember that exposure to native speech is always very beneficial. The more you listen, the more natural these rules will become.
All six rules exist because the language sounds more natural and is easier to pronounce with them. Mandarin isn't completely enslaved to its tones; it flows smoothly.