Just to add a little bit to the very good accepted answer:
In addition to the two distinctions already noted, there is at least one other situation in which native (at least American English) speakers will often use the stressed pronunciation.
In speech, when we are not sure what we are going to say next, most often we will use the stressed pronunciation:
I saw it in the(thee)...what do you call it...the(thuh) thing.
[reading aloud:] "Spinning around, she beheld the(thee)..." [turning page] "terrifying spectacle of a headless noun phrase!"
This distinction isn't a rule or even a conscious pattern; I never noticed myself doing it until it was pointed out1, but now if I'm paying attention I can tell that I do, and notice others doing it, as well.
Also, you'll probably notice that all of these patterns of distinction (before a vowel, for emphasis, and for uncertainty) also exist for the indefinite article.
A generally changes to an before a vowel sound (a fruit versus an orange, but some dialects drop the distinction and always use a).
There are two ways to say the article a: unstressed (something like uh, often represented with a schwa Ə) or stressed (like the name of the letter A). This distinction can be used for emphasis:
So, I heard this is the place to learn English!
Well, this is certainly a(A) place to learn English. I'd say a(Ə) pretty good place, in fact, but there are probably others.
And, as with the, it can also signal when we're unsure how we're going to finish our sentence:
Welcome to our fine fast food establishment's drive-through window! Would you like to try a(Ə) Super Gobbler Supreme?
Um, no, I'd like a(A)... (scanning the menu) ...hmm... a(Ə) small fry and a(Ə) water.
1 I first heard about this, I think, on a public radio interview with a linguist many moons ago. A related article (I'm not sure if it's by the same person I heard on the radio, but it's the same idea) is Pronouncing ‘‘the’’ as ‘thee’’ to signal problems in speaking by Fox Tree and Clark, 1996. From the abstract:
In a large corpus of spontaneous English conversation, speakers were found to use thiy to signal an immediate suspension of speech to deal with a problem in production. Fully 81% of the instances of thiy in the corpus were followed by a suspension of speech, whereas only 7% of a matched sample of thuhs were followed by such suspensions.