How does coupling between two trains work ?

The capacity of a rail convoy often needs to be adjusted to adapt to peak traffic.
Many trains have a fixed configuration. It is therefore necessary to resort to coupling between two trains:

How does coupling between two trains work ?