If OptiFine isn't working or the game crashes, try these fixes in order.
Fixes
OptiFine not showing in launcher: re-run the installer and check 'OptiFine' profile exists
Black screen with shaders: lower shader settings or update GPU drivers
Incompatible with Fabric: use the Forge or standalone version instead
Install button greyed out: install the matching Minecraft version first
Still broken?
Make sure you downloaded the correct version for your Minecraft version and mod loader, and that Java is up to date. A common cause is mixing Fabric and Forge builds - use the right one for your setup.