There is a switch inside the housing. Sometimes they go bad. The switch on my Agility 125 is under a bunch of plastic, so I can't tell you how to get it out.
Here's something else to check. See if your rear brake lever activates the brake light. I bet not, because it works off the same switch.