When you hang pictures and art on your walls, you want to get it right the first time to reduce the number of holes that you leave in your walls. Whether a screw or a nail is the best fastener to use depends primarily on the weight of the object that you are hanging.
Nails are sufficient for hanging lightweight pictures and objects from a wall. For small pictures, you don't need to ensure that the nail goes into a stud; just putting it through the drywall will hold it strongly enough to support something small. Drive the nail through the drywall so that it is sticking out of the wall at an upward angle of about 30 degrees, which will increase its strength and make things less likely to slip off of it.
For hanging heavy paintings, artworks and other objects from walls, you should definitely use a screw rather than a nail. In addition, the screw must go through the drywall and into a stud. If you hang a heavy picture on a screw that is only supported by drywall, it is likely to pull out of the drywall and crash to the floor. Find the stud by tapping on the wall with a hammer and listening for the spot where the sound is less hollow. Drive the screw in at a slight upward angle so that whatever is hung on it is held on the screw by gravity.
Some hooks are made to be held up by either a screw or a nail, and some hooks are made with screws on their ends to be screwed into a wall. A hook with an integral screw is the best fastener to use when hanging something heavy that you want to be sure won't fall. The screw, when it is firmly fastened to a stud, won't come out, and the hook on the front end will ensure that the wire or cord that is supporting the artwork won't slip off the end.
Use caution when driving nails and screws into the wall. Avoid areas that are at the same level as power outlets as this will increase the risk that you will put a nail or screw through a wire. If you feel strong resistance when you are screwing or nailing, stop. You may have hit a water pipe in the wall. In addition to ensuring that screws and nails are firmly attached to the wall, also see that hanging wires on the backs of paintings are firmly attached to the frames.