Nuts are almost always used in conjunction with a mating bolt to fasten multiple parts together. The two partners are kept together by a combination of their threads' friction, a slight stretching of the bolt, and compression of the parts to be held together.
In applications where vibration or rotation may work a nut loose, various locking mechanisms may be employed: lock washers, jam nuts, specialist adhesive thread-locking fluid such as Loctite, safety pins or lockwire in conjunction with castellated nuts, nylon inserts, or slightly oval-shaped threads