Nuts are another type of fastener with a threaded hole. Usually, a nut is the counterpart of bolt. Bolts can hold things together tightly thanks to the nuts. Nuts and bolts are used together to clamp two or more parts having unthreaded holes together. The two are kept together by a combination of several factors including the friction of their threads, stretching of the bolt, and compression of the parts that are to be held together.
To simplify, nuts are round discs that have a hole inside them used with bolts to fasten objects. In normal use, a nut-and-bolt joint holds together because the bolt is under constant tensile stress. The tensile stress pulls the nut threads against the bolt threads providing a clamping force that would prevent axial movement. However, when a joint is subjected to vibration, there is a tendency for the nut to easily loosen, therefore, specialized locking nuts are preferred in this situation.
Back then, nuts were commonly made with a simpler square head as they were easier to manufacture. However, due to the found advantages of hexagonal nuts, the latter became more popular.