What is the mechanism behind plants losing their leaves?
The process of a deciduous plant losing its leaves seasonally is known as abscission. It occurs when a layer of cells known as the abscission zone elongate and weaken, causing the leaf to fall off. It is mediated mainly by the hormones auxin and ethylene. 

The functional purpose of abscission is to remove leaves when they are no longer producing a net gain of biomass. Leaves decrease in productivity during drought, decreased day length, and when under the effect of herbivory. 

In some species (according to the day-length source), "When the daylength exceeds a certain 'critical' duration, growth may be
maintained continuously for at least 18 months under favourable tempera­ture conditions, e.g., in Liriodendron tulipifera, Robinia pseudacacia". So, to answer your final question, some deciduous species (but not all) may indeed retain their leaves if they are grown in favorable conditions. One reason why not all deciduous trees retain their leaves even in favorable conditions is that internal ageing can also induce abscission: "In such species, growth is determined primarily by the endogenous ageing process and is only modified by environmental factors, including daylength"