Getting the last hit in DotA simply means doing the final blow to a creep, hero or structure. For enemies, the purpose is to get the gold. For allies, it is to deny gold and experience points. This is an essential skill for every good DotA player.
Last Hitting is also important for lane control. When you are last hitting and denying effectively, then you can keep creeps close to your tower, which is helpful when avoiding ganks.
General strategy for getting the last hit:
Your most important tool for last hitting is the ALT key. Pressing this shows the health bars of every unit on the screen. This gives you an idea which unit is close to dying.
For melee heroes: Stand near the creeps and just hold your attacks, only go up to them for the last hit.
For ranged heroes: Move your hero around and stay within range so you can reach your target for the last hit.
Aside from these, it's important to know the time it takes for your hero to attack. Knowing your character's attack animation duration will help you properly time your last hit.
Another important thing to take note of while last hitting is your hero's damage. Of course, heroes with higher damage can last hit creeps when they have a higher health. You must know approximately how low the creep's health is before you last hit it.
Heroes with AoE skills are great for farming and getting the last hit on several units at the same time.