Spark plug sockets are used in exactly the same manner as standard sockets (see How to use a socket with a ratchet wrench). They attach to a turning tool with a square drive socket and also have a hex or bi-hex head, just like standard sockets.
When you are fitting a spark plug, you should use a torque wrench with your spark plug socket. This is to ensure that you do not over tighten the spark plug, which could damage it. You should be able to find the correct torque setting for your vehicle’s spark plugs in the user manual.
On some engines, the spark plugs will be recessed and you may have to use an extension bar with the spark plug socket in order to reach them.
For more information, see: How to use an extension bar with a ratchet and socket?