Is it the actual speedometer that quit working, or is it just the odometer that quit working? If it is only the odometer that quit working and the speedometer still indicates the correct speed, then one or more of your odometer gears have broken (extremely common). Go to
www.odometergears.com to get yourself some new ones - I have replaced two of the three in my speedo with this guy's gears, they work great, and it is an easy job to replace them.
If the actual speedometer isn't working, then either the speedo itself is bad (in which case you'd probably be best off finding yourself a used one on ebay or in a junkyard - new ones are over $200 from BMW), there is a bad solder connection in your gauge cluster, or the speedo sending unit in the back of the differential housing is either bad or the wire connections are corroded and need to be cleaned.