When the is followed by a vowel sound, it is usually pronounced /ðiː/ (dhee), so that the e sounds like the ee in see or fee.
When the is followed by a consonant sound, it is usually pronounced /ðə/ (dhaa), so that the e sounds like the a in comma or the u in sum. However, the vowel is sometimes so short that it is barely noticeable (dh).
There is an exception though. When the is stressed for emphasis, it is usually pronounced /ðə/ (dhaa), regardless of the sound following it.