Choosing the right fastener for a particular product can be quite tricky. This web page is meant to provide a very shallow overview on some of the issues surrounding fastener selection. The broadest classification of fasteners is whether they are permanent or removable.
Fasteners serve the purpose of limiting the motion of parts with respect to one another.
One chooses to use only the number of fasteners that minimally limit the motion of parts to the requirements of the problem. E.g. don't use 4 fasteners if 3 are enough.
Separate fasteners (e.g. bolts, screws) also make a product more complex by adding to the number of parts. All else being equal, the greater the number of parts, the more likely a failure is. So minimizing the number of separate fasteners is usually a desirable design objective.
The key factors influencing fastener selection are:
All bolt-like fasteners (including rivets) work by squeezing two parts together. The head and tail of the fastener (the nut, in the case of a bolt) carry the compressive loads and distribute them into the parts being fastened. The fastener body is then in tension (it's being stretched).
Permanent fasteners include welds, rivets, and irreversible snap connectors. These are used in cases where the only cases where the fastener would be removed are at end of life, or for major maintenance.
Permanent fasteners can be relatively difficult to install (e.g. it's harder to rivet 2 parts together than to bolt them together).
A removable fastener (screws, bolts, detachable snap connectors, etc.) are used where an inherent part of the fastener's function is to allow parts to be detached (say, for maintenance purposes).
Removable fasteners are often relatively easy to install, compared to permanent fasteners.
Sometimes, the head/tail of the fastener isn't enough to distribute the load properly. In this case, a washer can be used to spread the load out further.
If one can calculate the load that a fastener will have to carry, one can then search existing databases for a suitable fastener. Such data is commonly available in handbooks. It is also available online. Some online examples include:
An interesting web site dealing with more details of fastener design & selection is: the Online Fastener Design Manual.