OptiFine is a mod for Minecraft: Java Edition which, among other things, allows the game to load shader packs.
The official download page contains links for many versions of Minecraft. The most recent version is displayed first. All other versions can be found by clicking "Show all versions". This will show the recommended version of OptiFine for each Minecraft version. If you want to try the latest version instead of the recommended version, you can find that by clicking "+ Preview versions" for the version of Minecraft you're using. If you happen to need an older version of OptiFine, you can find them by clicking "+ More".
The OptiFine.jar file will work as a stand-alone installation wizard. Simply double click the OptiFine.jar file to run it, and then click "Install".
If the OptiFine.jar file does not do anything when you double click it, make sure you have Java installed. You can download Java from AdoptOpenJDK.
If the OptiFine.jar file opens with something else unrelated to Java (like 7zip or WinRar), try running Jarfix first.
Important note: The OptiFine installation wizard will only work with the official Minecraft launcher provided by Mojang.
OptiFine has built-in compatibility with Forge. As such, you can just put your OptiFine.jar file in your mods folder just like any other forge mod. The official download page will also say which version of Forge is supported for the OptiFine version you downloaded. Using a different version of Forge might not work correctly.
When using Fabric, you will also need to install OptiFabric in addition to OptiFine. From there, simply put both OptiFabric.jar and OptiFine.jar into your mods folder, similarly to Forge.
Instructions on installing OptiFine with MultiMC can be found on MultiMC's wiki.