The energy transfer process in planetary flybys