How to make an object freely rotate on an axis?

I love it! How did you end up doing it ?