How to identify the origin of an issue or an unexpected behavior?

How to identify the origin of an issue or an unexpected behavior?