Why choosing for prime numbers eliminates vibration?
In trying to answer this question I came across a lot of interesting phenomena related to primes. This is not a very detailed answer but will hopefully I can share the intuition and feel of the concepts involved.
The phenomena we are dealing with is resonance.
In any machine, there are several parts. Each part has some resonant frequency(a natural frequency). Now a noticeable vibration occurs when the magnitude of this oscillation increases. How will that happen? If you have two parts whose resonant frequencies are the same or multiples of each other, when every one part vibrates it sort of hits the other and makes the other part vibrate with a larger amplitude. Therefore slowly the amplitude of oscillation in both parts will increase due to a feedback mechanism and eventually such a large vibration can damage the machine.
The same goes for a wheel. Actually you cannot just look at spokes. There will also be some mechanism underneath which is holding on to the wheel with certain number of extensions. For example for the axle of the car to have good grip on the wheels it must have some elements extending from the axle to lock with the wheel. Now let the number of extensions be n1 and number of spokes be n2. If n1 and n2 are multiples of each other, due to the feedback mechanism discussed, large vibrations could be caused. Hence in general n1 and n2 need to be co-prime and in most cases the numbers 3,5,7 are used. As far as I understand it, co-prime numbers reduce the vibrations because they cancel each other out.
I got an idea for this answer from two phenomena. One is described here - https://www.reddit.com/r/askscience/comments/1aulwq/why_are_frequencies_in_hz_which_are_prime_numbers/
The second object was a pedestal fan. Have you ever wondered why the number of blades in a fan and the number of spokes in it's casing are not the same? The same concept applies. That is why for a 3 blade fan, a 5 spoke casing is used even though it costs more money to make such a casing than a 3 spoke casing.
Prime numbers are generally used to reduce the magnitude of resonances. These occur in a non-linear multi-frequency system when two of the frequencies $\omega_1:\omega_2$ match at a ratio $p:q$, where $p,q$ are comprime integers.
For simplicity, you can think of a minimal example of such a system as two (non-linear) oscillators that are coupled with a dimensionless strength $\epsilon$. Say that oscillator 2 is not oscillating, then the driving from oscillator 1 will generally cause it to oscillate with a kinetic energy proportional to $\epsilon$. However, at resonance, the response of oscillator $2$ scales as $\sqrt{\epsilon}$. Funny things can happen in dissipative systems, where you expect any vibration to be damped, but it turns out that sometimes a sustained resonance occurs that keeps the secondary oscillation "locked" in place for prolonged amounts of time that scale as $\propto t_{\rm diss}/\sqrt{\epsilon}$, where $t_{\rm diss}$ is the dissipative time scale (but generally the system stays in resonance for a $\propto t_{\rm diss} \sqrt{\epsilon}$ time).
On the other hand, this response is also exponentially suppressed by a factor $\exp\left[-\alpha(|p|+|q|)\right]$ with $\alpha$ some positive number, at least for reasonably smooth couplings between the oscillations. In other words, when the $p,q$ in the resonance are large numbers, the resonance is of "high order", and its magnitude will be much smaller and much less bothering. As a rule of thumb, you have to care about resonances with $|p|+|q|$ up to 5 or so.
Now consider the example of the wheel with 5 spokes. The contact of the wheel with the road will bring a driving with the rotation frequency $\Omega$ into the system. However, the next leading harmonic of the driving will have a frequency $5\Omega$ because of the spokes. Now if there are oscillators in the system with proper frequencies $\omega$ such that $\omega/\Omega = p/q$, then the secondary resonance $\omega/(5\Omega) = p/(5q)$ is a much higher-order resonance ($|p|+|5q|\geq6$) unless $p$ is a multiple of five. But if $p$ is a multiple of five, the primary resonance has $|p|+|q|\geq 6$ and should already be reasonably weak. So pushing the next harmonic to 5 times the main frequency seems to be a reasonable to choice to somewhat reduce resonant response, and these kinds of rules will apply for any prime.
On the other hand, this is not a big reduction in the resonant response, the only way to muddle resonances out is really to make sure the oscillations in the system are non-linear (their frequency spectrum is non-degenerate, the oscillators are highly anharmonic), they are not likely to match the driving frequencies or each other in low-order ratios ($1:1$, $1:2$), and that sufficient damping is present.
Consider also the fact that moving a lot of the power of the driving of the system through the wheel to the next harmonic $5\Omega$ means essentially making the wheel less round. But there is a lot of reasons why you want to have your wheel round, so I do not believe the power in the next harmonic will really be large.
So, I believe there must be a number of other reasons to choose the number of spokes, and 5 is really a compromise between a number of factors such as manufacturing and robustness as mentioned in some of the other answers here.