When selling software online what's the most suitable/secure way to provide activation in order to get rid of pirates copies of the software? Is there any well-known software for this purpose?
You pretty much can't. Any pirate group who wants to crack your software will, for fun, and then give it to everyone else and there is nothing you can do. Microsoft can't keep Windows off torrent sites, and the UK government can't stop people visiting The Pirate Bay.
There's a reason that the new wisdom in many creative circles is to accept piracy and use it for free marketing- for example, release your old books for free to generate hype for a new one, which Neil Gaiman did to great success, and it's because there are no technical solutions to the problem of piracy.
Services like Steam which offer high-quality services are growing at a massive rate and still raking in embarassing amounts of money, long after everyone else said the PC market was dead due to piracy. Now it's the most vibrant market of games there is.
Piracy is not a technical problem, and there's no code you can write to solve it. It's a service problem. Those industries which offer strong digital services like games and books are doing fine, regardless of piracy. Those which are stuck in the 70s, like films, are not.
For example, can you download a film in full HD, watch and take it where and whenever you want, and re-download it to view whenever you want? That's service, but the MPAA don't offer it. So is it really a surprise that would-be filmgoers turn to torrent sites instead?
Face it: you will be unable to get rid of all pirated copies of your software.
Any anti-piracy system can be worked around. A sufficiently interested warez person/group could write a crack which bypasses the activation-related parts in your software. You could write a counterattack to this, and then it becomes a catch: pirates vs. your implementations of anti-piracy methods.
The most common systems uses license keys + validating them against a remote server, which provides little hassle to legitimate users. This can also be used to add value: only legitimate users will have access to some features - pirated copies can go into a crippled mode.
However, even this has its problems: what if your license servers go down for any reason, or your company goes bankrupt? So you will have to understand and learn to live with those limitations.
Since you're selling your software online, you could also use a license file which is encrypted and validated against a server. Optionally, adding some sort of machine identification (e.g. by hardware characteristics), to avoid people copying the same license file to different machines.
This Stack Overflow question can be interesting reading: I've found my software as cracked download on Internet, what to do?, and this Slashdot post: Ask Slashdot: Copy Protection Advice For ~$10k Software? is relevant too.
License keys by far. There are some open source license key generators - Google lists a few right not top for that search. Which you choose depends on what language you are using.
If there is an online service that is an integral part of your software, then that can be sufficiently secured.
However don't be tempted to add some "token online service" just for the sake of using it as copy-protection: that will be worked around.
In fact, the online service would be the real product, with the actual software being just a way to access it (so you might as well give the software itself away).
Of course this approach has all the usual constraints of requiring a permanent internet connection (don't be fooled, even in our modern world, that's still a deal-breaker sometimes).
As already stated, there is no way to fully protect desktop software.
However, not all is lost. The only real way to protect your software is to have significant part of the software working in SaaS model, with the desktop being just a client, useless without the back-end. This of course means, that users have to be on-line to use it, but nowadays, that's not a huge issue.
If you're really dead set on preventing piracy there's one hardware-dongle based system that has never been fully cracked as far as I have been able to ascertain: WIBU CodeMeter. That they haven't been cracked is of course out of their own press releases (Hacker Contest - WIBU still uncracked) so take the claim with a grain of salt, but at least they are confident enough to hold these contests!
This system is based around hardware encryption on the key itself and all kinds of tamper-proofing in the hardware and software. They regularly update their system as well.
Logistically shipping hardware keys can be a pretty big overhead, and the keys and licenses are not free. You pay for the hardware, and you pay a (small) fee per license activation.
They do offer a software-only version (CodeMeterACT) but this is less secure, by their own admission.
Anyone sufficiently motivated will be able to break you anti-piracy measures. No matter what encryption validation scheme you use at the end of the day you must have a clean executable in memory. And this can be used as the basis for defeating your scheme.
You are liable to lose more sales through honest customers disliking whatever hoops your anti-piracy scheme makes them jump through, than, you will through illegal copying.