Why Do Gradient Methods Work In Optimization And Sampling?