Drywall mud is basically either regular mud or what is called "hot mud." Both of these types need to be mixed with water before they can be used. Hot mud dries much faster than regular mud. To save time when making drywall repairs, many do-it-yourselfers use ready-mix drywall mud, which is often stiff and needs to be mixed with a little water to make it the right consistency.
One occasion when you would apply drywall mud directly onto the painted wall is to cover a dent. The dent could be caused by something banging against the wall or from the dimple created by tapping a popped nail back down below the drywall surface. Two coats of drywall mud are likely needed to fill the dent or dimple, with the first coat shrinking a bit and the second coat completely filling in the recess. Sand the mud after it dries, apply primer and paint the spot to match the rest of the painted wall.
If the wall is cracked, cut away any paint layers and loose drywall from over the crack using a utility knife. Embed paper drywall tape in the mud over the crack, and press out any air bubbles from underneath the tape with a drywall taping knife. Smooth the successive layers of mud out about 6 inches over the painted wall around the crack. Once the mud dries, sand it smooth so that it is level with the surrounding wall, then prime and paint it. Be aware that sometimes you may need to repaint the entire wall so that the repaired spot does not noticeably stand out.
You often need to use one or two additional layers of mud, depending on the size of the crack or hole that you repair. Each layer of mud takes approximately 24 hours to dry. If you use regular drywall mud that you mixed up, save the mixed mud for the upcoming layers by topping off the mud with water. Pour a couple inches of water on top of the mud in the bucket, and scrape the mud down from the sides of the bucket, which prevents the mud from drying out while you wait for the mud on the wall to dry. When you are ready to use the mud, dump the excess water off the top.