How would an advanced alien civilization design screws or similar fasteners?
Four improvements in particular occur to me: bayonet connections, two-quarters threads, hollow threads, and positive screwdriver coupling.
Bayonet connections like those used for camera lenses, BNC cables, fluorescent light starters, US childproof pill bottles, and some kinds of lightbulbs (the English standard) are far superior to screws in most cases, though they do require a spring.
I understand that some barrels use threads that run around only one quarter of the barrel, leave a slot for one quarter of the barrel, run around another quarter of the barrel, then leave a slot for the final quarter. So, by rotating the barrel to the position where the threads do not engage, you can just insert it translationally, then screw it a quarter-turn to lock it into place. This scheme also allows fractional numbers of starts and variable mechanical advantage, similar to bayonet connections, and of course you can use it with larger numbers of starts as well.
By adding a stop at the end of the quarter-turn rotation, as in bayonet connections, you can prevent the screw from being turned too far, which will weaken the connection.
If there is a bit of waviness to the thread, an energy barrier can be provided which will make the screw resistant to coming out during impact or vibration; it must rotate a significant amount before the energy gradient tends toward screwing out, as it always does in a conventional screw, rather than back in. This undulation must come out of the clearance between the inner and outer threads, so it may be necessary to increase the thread spacing to permit it.
By using different thread pitches at different positions along a tapped hole that joins two or more pieces, you can cause the screw to squeeze them apart or, more promisingly, together, by an amount determined by the difference between the thread pitches. Conventional bolted joints depend on the screw head and the nut bearing against the tapped material for this, but if the hole is long, the screw threads can engage more material, thus producing a joint stronger against pullout. This also eliminates the need for a screw head in many applications, allowing the use of a headless screw similar to a grub screw.
A conventional screw is only stretched in three areas: any shanks where threads are absent; near its head; and near each place where it passes through a gap between two parts. This purely local stretching makes for maximal rigidity, and consequently maximal fragility to impacts. If this is not desirable, one approach is to leave a long unthreaded shank between the threads needed to provide enough engagement to prevent pullout, in either the screw or the hole or, ideally, both. A better tradeoff can be provided in many applications by making the threads at each end a hollow cylinder maintained in compression, free to slide along an internal unthreaded shank or tension rod which is welded to the thread-covered pipes at each end of the fastener. (So they’re only sliding to the extent that either the threads or the rod are deforming.) This may reduce the screw’s tensile strength somewhat, because the shank is narrower than it would otherwise be — although the thread roots are no longer available as crack-initiation stress risers. But it increases the impact resistance of the joint, because the screw can extend further before breaking, so more energy is needed to break it.
Positive screwdriver coupling might involve a ball bearing that pops out of the side of a square-drive screwdriver to engage a cavity in the screw head, with a shim that slides into place inside the screwdriver to lock the ball bearing in place. A simpler design uses an L-shaped screwdriver blade half the width of the screwdriver and a shim that slides in behind it to push the bottom of the L into a slot in the screw head.