Similar for the e46/e39. There is a cable harness that runs from the main body to the bootlid. You can see this on the right hand side of the car, it will look like a black rubber concertina'd tube.
What happens is the wires inside get brittle, both from the cold weather exposure & the constant bending as a result of the boot opening & closing. After a while the copper strands will eventually break causing the circuit to break & hence the light not working.
If you're lucky the problem stops there & you simply find the most efficient way to rejoin the wires inside the rubber tubing (using solder & some heat shrink ideally).
However, if a number of the wires break & end up shorting off each other then the FRM/LM (light control module) begins to record these instances of short circuits. If an individual circuit hits 30 short circuit events (or maybe 60 events, not sure on number) then module will no longer provide power to that circuit. It will shut down supply to protect itself.
However, all it not lost as it is possible to reset these counters that store the information. You need to use the Tool32 software tool which is part of the BMW Standard Tools package (i.e. INPA & NCS expert). There are 64 different circuits that are monitored & protected in this way in the FRM/LM.
Note: there could be cases where headlights or front light (or indeed any other lighting circuit) could be affected by this issue.
Just something to bear in mind if you have an unexplained light that won't work after all the bulbs have been replaced & wiring checked/repaired.