Technical breakdown: How does KMSPico really work?

Everyone knows that KMSPico ( https://collegeflightplan.com/kms-pico-activator/ ) activates Windows and Office, but how exactly does it do it? If you dig deeper, you'll find that it's not just a “keygen” or a patcher - it emulates a local KMS server, making the system think it's connected to a Microsoft corporate license server.

But here's what's interesting:
???? What is the difference between KMSPico and the official KMS activator?
???? Why can't Microsoft block this method completely?
???? Is it true that some KMSPico builds contain hidden backdoors or miners?

If you understand the technical side, it becomes clear why some people consider KMSPico a brilliant solution and others consider it a dangerous tool. Can anyone explain its mechanism in detail or share links to a real code breakdown (if there is one)?

And the main question: is it possible to replicate this activation principle without the risk of viruses - for example, with the help of self-written scripts?