There is the ability for you to manually download GameMaker runtimes for cases when restricted internet access or very slow speeds will cause the automatic download attempt within the IDE to have issues.
You should review your ui.log to confirm it is a download issue you have before proceeding with this guide because if your issue is actually that your runtime installation fails due to file write permissions or an overly-sensitive antivirus client on your machine, downloading the runtimes manually via this system will not change that outcome and the installation will still fail. (If that is the case, you need to follow this FAQ on setting correct file permissions and antivirus settings instead.)
Getting The Runtimes
If you navigate to https://gamemaker.io/account/runtimes (log into your YoYo Account if you're asked to), you will see a list of your currently accessible runtimes. Something like the following:
If you click onto a runtime you will see a list of your available runtimes based on which GameMaker products you own. This page also contains instructions on where to place the zips when they are downloaded. You will always need the Core Runtime and also whichever platform(s) you wish to develop for.
Please note that we would always recommend you just get the latest runtime version, but it is also important that you install the matching runtime for the IDE version you have installed, otherwise you may have issues creating and building projects. (E.g., download the latest 2022.9.x runtime version if you have installed the 2022.9 IDE.)
Still An Issue?
If this still fails to install your runtime, please report a bug and attach your ui.log file, which can be found in the folder %programdata%\GameMakerStudio2\ (Windows) and /Users/Shared/GameMakerStudio2/ (macOS).