Detect when PIE play session end?

As the subject says, how to detect it in C++? ie when user click button stop at the Editor. The reason is I will be able to insert some remark in the log, so user can see that the logs separated session.

Have you tried looking into the UGameInstance::Shutdown() method?
You can use the WITH_EDITOR macro to distinguish between Editor and Standalone builds.

Bind to FEditorDelegates::EndPIE. Heaps of useful delegates in that class, and more in FCoreDelegates/FWorldDelegates too.

yes, I use editor delegates in this way: FDelegateHandle EndPIEdelegate = FEditorDelegates::EndPIE.AddRaw([your class], &[your method]);
and then be sure that you remove all delegates if you don’t need it anymore: FEditorDelegates::EndPIE.Remove(EndPIEdelegate);