I think you are low on transmission fluid. You've likely got a leak around your gasket, or if you did some work on your trans recently, the mechanic did not put enough oil back. You'll need to top up oil, change the oil seal and filter as well (ideally). If not, just top up oil will do. Refer to the Bentley manual for E39s for the oil top up procedure. The gearbox needs to be warmed up to a certain temperature, the engine needs to be running, and someone needs to shift through all the available gears in manual mode, while someone else pumps in the transmission oil. Best to use the same transmission oil that your car came with, althrough Dex6 should be fine as well.
Another symptom of low trans fluid.....drive fast then do a hard brake. Once the car stops, release the brake pedal and do not step on the accelerator. If the car takes a few seconds to begin moving instead of moving almost immediately, then its confirmed. What happens : during a hard brake, trans oil is slushed to the front of the gearbox, temporarily depleting the rear. The gbox detects low oil around the gears and does not engage. It waits for oil to flow back to a sufficient level before engaging....this is to prevent damage. If you have enough oil in the gbox, there'll be enough oil left een after a hard brake. Please do this only after your car/gbox is warmed up and behaving normally. Let us know how it goes.