Well, since this issue's already come up once today, I guess I better elaborate my comment.
As it turns out, why may only be used in a relative clause that modifies the noun reason.
In much the same way, relatives with where must modify a place noun, and relatives with when must modify a time noun. While there are a lot of time and place nouns, there's only one reason noun, and it's reason.
Since the structure is so constrained, and so redundant, something is often deleted,
so that a simple tensed clause following reason implies why.
- He didn't tell me the reason why he wore a polka-dot dress.
- He didn't tell me the reason that he wore a polka-dot dress.
- He didn't tell me the reason he wore a polka-dot dress.
Similarly, leaving out the reason, but leaving in why, produces an embedded question clause
(also known as a free relative clause or a headless relative)
- He didn't tell me why he wore a polka-dot dress.
that also does the same job.