Pull the cap off the rear of the assembly, unplug the bulb from the reflector tube and pull the bulb with the wiring out from the rear so you can get a good look at the wiring harness. A common issue with W211 is the high degradation rate of the wiring because it used to Green eco wiring, or something. So, it gets brittle within a certain time and turns to dust and there will be no shielding between the two sides. When the two touch, the power is diverted and hence no power to the bulb.
You can temporarily, maybe even longer, fix this with electrical tape and wrapping the two wires individually.
For a more permanent solution, there is liquid electrical tape which is applied by brush over the wire as insulation replacement. The wiring harness can also be replaced with some diligence. Both complete harness and the bulb receptor with just the tails are available.
Headlight Wire Harness:
211 820 03 61, 2118200361, 1592244
211 820 04 61, 2118200461, 1592245
Available at Walmart.