how does the last hit hack work?

No, you need to hold that key while having right clicked an enemy creep. It keeps canceling your animation until it believes it can kill the unit.

It will work a lot better if you have the "Auto Attack" option turned off in Dota 2's settings.