StarCraft 2 requires me to enter my password every time I launch the game. Is there a way to bypass this inconvenience, for example by making it remember the password somehow?
No, Starcraft II itself cannot remember your Battle.net password.
It's only illegal if your macro/hotkey scripts are actually performing actions within the game itself.
If you're looking for some tools to automate the launch process, you can look into AutoHotkey or HotkeyNet.
To be more exact, follow the one action, one keystroke rule. Which means that any character action or UI input must be the immediate result of a human pressing a key. So while I can have a single key macro to press multiple hotkeys simultaneously, it would be illegal to make it so that when I press a button, keystrokes would be sent to the game client 5 seconds later. Any sort of "wait" action in your macros are against the ToU. As a multiboxer, I can personally affirm that it is fine to have me press '1' on my keyboard and have all 5 of my shamans cast lightning bolt. It's not fine for me to have a macro that sends 'D' (unload) on a Nydus network every 20 seconds for remote Drone mining.
Once upon a time, there was a way to make World of Warcraft (Blizzard's other giant game) remember your password. You could edit certain files to have your password be filled in automatically.
Blizzard specifically disabled this ability, by removing all ability to change the login screens. They did this in part to prevent spyware/viruses from editing them (to steal your password), and in part because many people play Blizzard games on shared computers in cyber-cafes, where saved passwords could lead to all sorts of mischief.
So, you can't directly save your password for a Blizzard game. At least not until 2027 when you can install ActivisFaceBlizzTwitterBook directly into your cerebral cortex.
Carl's answer mentions some ways to get around this; however, save your password into a macro hotkey program at your own risk.
I suggest that you use a keyboard macro software like AHK to help you :
1) Start SC2 2) Connect to Battle.net 3) Input your password.
It might take you a while to learn AHK or something similar, but if you are a programmer, you will like.