Solder mask opening is required for the below four situations.
Solder mask opening for PCB pads
PCB pads are the contacts that need to be surface mounted with electronic components, such as resistors, capacitors, ICs, etc. So PCB pads should not be printed with PCB ink. That means when you do the PCB design, in the solder mask layer, you should create a solder mask opening for each PCB pad.
Solder mask opening for PCB Vias
Not all PCB vias need solder mask opening, it all depends on your PCB needs.
For better thermal dissipation of your PCB, you can design solder mask openings for the PCB vias. Especially for power supply PCBs that flow large currents, solder mask opening for thermal dissipation is common. You can also fill in the solder mask opening with tin, which acts as a metal heat sink.
Solder mask opening for PCB vias also serves as a PCB test point. Because the copper is exposed, you can process PCB tests here.
Above are two purposes of solder mask opening for PCB vias. However, PCB vias can also be prayed with solder masks to protect the copper from oxidation, especially from aggressive environments.
Solder mask opening for gold fingers
PCB gold fingers are a column of exposed hard gold plating pads on the PCB edge for plug-in and connection. Solder mask opening is necessary for gold fingers because solder mask is insulative while gold fingers serve for connection and need to have excellent conductivity.
You don't need to worry about the oxidation of the gold fingers without solder masks. The surface finish, hard gold plating well protects the copper pads.
Solder mask opening for ground
You can design solder mask openings for PCB grounding. The exposed copper can connect with the metal shell. In this way, the PCB is grounded.
Solder mask opening for copper thickness measurement
During PCB manufacturing, we need to measure the PCB copper thickness to see if it is qualified.
Solder mask opening for PCB antenna
PCB antennas transmit and receive RF microwaves and will consume much power. For high-frequency PCBs, solder mask opening for PCB antennas is common, because the antenna can consume smaller power.