Will a computer fail sooner the more you use it?
There's no simple answer to that. There are different types of stresses that may all contribute to the lifetime of the parts a computer is built from.
Some types of stress are directly related to operating hours. For example, some chips can be degraded over time by electromigration effects in the silicon crystal. Basically, atoms may move in the crystal lattice because they are under the effect of a high current density, or a high electrical field strength. In most cases, however, it takes decades until this leads to a defect.
Some types of stress are related to switching the circuit on or off. For example, this can be related to inrush currents when switching on, which can degrade certain components, predominantly in the power supply.
Some types of stress are related to temperature. For example, aluminum electrolytic capacitors degrade faster in hot environments. Leaving the computer on may expose them to higher temperatures on average, hence shorter lifetime.
Some types of stress are related to temperature changes. For example, mechanical stresses due to temperature gradients may affect the reliability of solder joints, and can eventually lead to contact failure. Those types of stresses are best avoided by keeping temperatures constant, which would mean to leave the computer running.
Some stresses are associated with usage of a component. For example, SSDs rely on NAND flash chips, which consists of memory cells that degrade whenever they are reprogrammed. Therefore, an SSD has a limited lifetime in terms of write operations.
Some stresses are related to mechanical wear-out. For example, bearings of motors, for example of a fan, eventually fail after a certain amount of time due to mechanical wear.
You see: The various types of stresses are in conflict regarding how to avoid them. This is why there's no easy answer.
However, in server applications, where the computer usually runs 24/7, it is typically the power supply that fails, which is why many servers or network switches have redundant power supplies that can be exchanged while the system keeps running. The same may apply to fans, which sometimes can be exchanged during operation, too.