Help replacing a dimmer switch
Disregard wires that are not part of your project

And leave them alone.  What those other wires are doing is scientifically interesting, but attempting to learn electrical wiring by disassembling ones house is out of the question. Much easier on everyone's nerves to get a "How To" book from the library and read it through.

The red wire is a spare, to allow switching of fan and fan-light separately.  You are not using it today.  That is a good sign, it means the builder actually intended that ceiling box for a fan, and presumably used fan-rated boxes. 

Ground wires are very important, but they have a simple M.O. - every ground connects to every other ground. That's all they ever do. They don't need thinking about, so when trying to understand a circuit, you can disregard them.  Just don't forget them. 

So we ignore all the things we don't care about, what's left? I see 2 wires.  Black and black.   Looking at a common light switch, I see 2 screws.   Easy as it gets.

Mechanically

Those extra wires are called "pigtails".  For the supply black, you need a pigtail.  For the other one, as you note it is redundant, and could just go direct to the switch.  (Either way is acceptable, I broadly use pigtails even when I don't have to, because it lets me attach the pigtails at a workbench instead of up a ladder). 

If those pigtails are permanently attached to the dimmer, don't use them.  It will wreck a perfectly good dimmer to cut them, but they may be too small a wire size - often dimmers are provided with lighter wires, and UL allows that because they are pigtailed like this, but lightening up the wire is not allowed here.  However, these wires look like the same wire stock already in the box, look for screws at the dimmer: if you can remove them, just do so, and attach them to the new switch. 

When attaching to the switch, two methods are generally available: shape a J-hook to wrap them around the screw (clockwise) then tighten...  or push them in a backstab hole which grabs them tight. The backstabs seem much easier, but are unreliable and cause a lot of weird problems later. If you have a better quality switch, the backwire  holes may be directly under the screws, those you tighten the screw to clamp the wire.  Those are OK.