Developer forums and subreddits like r/softwaregiveaways occasionally have legitimate license giveaways from the publisher. These are time-limited but perfectly legal.
Some sites offer a “cracked” version of the software rather than a key. These executable files are modified to bypass license checks. However, they are extremely dangerous (more on that below).