Grounding for safety (vs grounding for signal integrity, which is a whole different issue, see below) is primarily a concern for equipment in a metal enclosure. If there is a wiring fault inside the device (frayed wire shorting against the metal inside), then the outer shell of the unit may be electrified. Guess what happens when you touch it? Ouch! By having a ground path, you give the electrical current somewhere else to go (instead of through your body when you touch the device).
You will notice that most devices in a metal enclosure will have a 3-prong input power (if the power plugs in directly without an AC/DC power brick), and also a chassis ground screw.
If you are grounded through the power cord, the middle prong should be connected to the building's wiring and then to an earth grounding rod, assuming your building was properly wired using modern building codes. There are inexpensive testers that can check to make sure your outlet is wired correctly.
If you use the chassis ground screw, you typically connect it to a grounding bus bar mounted on the wall, which is then connected to an earth ground. If you don't have a bus bar in your setup, you might be able to "cheat" by wiring it up to the grounding prong or center screw of an electrical outlet. (This is not ideal, and probably would not pass a code inspection, but it is better than nothing.)
Your local safety codes may require one or the other be hooked up, or both. It may also depend on whether it is a temporary item (e.g. a 5-port switch on someone's desk), or a permanent installation (something bolted to a wall). Check your local codes.
For rackmount devices, they are typically grounded to the metal frame of the rack by being bolted to it. Then there is is typically a grounding connection from the metal frame of the rack to a bus bar, which in turn grounds all of the devices mounted in the rack. This is in addition to the grounding provided via the power cords. Cable conduits, ladders, rack doors should be grounded as well (any exposed metal). Page 3 of this PDF provides a useful illustration.
For a consumer-grade desktop switch in a plastic shell like the ones you mentioned: There is usually no option for attaching a ground because it is not required since there is no exposed metal. The only things you should do is make sure your outlets are wired correctly (using the aforementioned tester), and use a surge suppressor (power strip or UPS).
Grounding for Signal Integrity: The other reason you might need to pay attention to grounding is if you have a signal integrity problem (corrupt data). Two big ways this can come into play:
In an electronic system, ground is the reference point for "zero volts". Ground is not the same everywhere you are, so two physically separate systems may disagree on what is a "1" or a "0". This can lead to all kinds of "interesting" communication problems. A common way you can run into this is if one of the computers connected to the switch is on a separate electrical power system (e.g. two buildings connected by an underground cable). In that case, it is recommended that you use fiber ethernet (not a consumer grade switch).
Electronic interference and "noise". Power cables running next to data cables. EMI due to a large electric compressor next to your wiring closet. These kinds of problems can be mitigated with grounded conduits and other forms of shielding (or just use fiber).
Generally speaking, Ethernet is is much more forgiving than say RS-232 when it comes to grounding issues because the signaling is differential and uses an isolation transformer. So, you usually do not need to worry about signal integrity grounding in a typical office environment. However, problems can still occur in "harsh" environments, like a factory floor. If you have a higher-end managed switch, it can give you statistics on Layer 1-2 communication errors, which will give you some idea if there are physical problems with your wiring that need to be addressed.