This page will link to resources that will help you get started with programming your own shaders using the various pipelines currently in use in Minecraft, with a focus on the Optifine pipeline.
There are 3 general sets of background knowledge for shader development: linear algebra, GLSL, and OptiFine's rendering pipeline.
Linear algebra is useful for shader development because vector and matrix operations are very common in shaders (and 3D graphics in general). 3blue1brown on YouTube has a decent series on this here.
GLSL is OpenGL's Shader Language. There are quite a few tutorials for this on the internet, but Minecraft in particular uses an old OpenGL version, so it might be useful to try to find an equally old GLSL tutorial. Anything that says #version 120 will be best. Minecraft 1.17 will use #version 150, but you are not restricted to just these specific #version's. You can use any #version that your GPU/drivers support.
OptiFine's rendering pipeline has a bit of documentation the doc folder. In particular, look at shaders.txt and shaders.properties. This documentation can also be found inside the OptiFine.jar file you downloaded.
Once you have all that down, there are 2 common ways to start putting your skills into practice: edit someone else's pack, or make your own from scratch. You will learn different skills from both of these practices, so it is recommended to try both of them at least once, but start with whichever one you're more comfortable with.