One of my remotes lost it's prgramation suddenly

The battery is OK (tested), but it will not lock / unlock the doors anymore (it does start the engine, it's just lost the "remote" key function)

1- How can I re-program my remote FOB

2- What could have been the reason for a sudden deprogramation ??