I had this problem recently and tried cleaning all the contacts up and making sure the contacts were touching ok but couldn't get the lights to work.
In the end I traced it back to a faulty earth wire were the loom comes out of the boot opening and into the boot lid, i just tapped into the blue earth wires on the number plate light/boot release assembly and ran a new earth cable to one of the nuts on the boot catch, job done