Why elbows have to be bent for shoulder exercises like front and lateral dumbbell raise? Does it harm or benefit any other muscle?
You don't have to bend your elbows for a db raise. EXRX, as an example notes:
Grasp dumbbells in both hands. Position dumbbells in front of upper legs with elbows straight or slightly bent.
When you bend your elbows, you do three things:
You lower the leverage because the lever arm (literally, your arm in this case) is shorter. If you have a 33" arm, at fully extended the dumbbell is 33" in front of you (basically). If you bend a bit, the dumbbell is now maybe 25" in front of you: that's a big difference in the amount of weight you can lift.
If something hurts, or you have any particular weakness in the range of motion you can quickly shorten the lever even more, reducing the loading on your shoulder in a dynamic as-needed fashion.
A locked elbow puts much more load on the elbow joint itself and does not engage the muscles (particularly the brachioradialis, biceps, and brachialis) to share the load. Static loading the bones and connective tissue and not using muscles as stabilizers is frequently why for most exercises you want to have a "slight bend".
The human body has a pretty natural way to produce force. If you had to push a car, you would (probably) take a breath, hold it in, bend your knees, and bend your elbows. Giving a car a push with arms fully locked is naturally unappealing for the reasons I tried to breakdown above.