How did western music decided on 12 equal temperament instead of the other ones?(Like pentatonic etc...) Is there any historical aspect of it?
This is my understanding of the evolution of scales in Western music. I don't have a set of resources for this, as it's my own understanding of what I have read, tutorials I've watched, and conversations with other musicians.
AFAIK, what is common in different cultures is the octave: fundamental interval, 2x frequency, and it sounds as "the same note" to our ears. It's a great interval but you can't make a scale out of it.
The first scales invented/discovered in Western music were the Pythagorean scales. Pythagoras used the next "fundamental interval": the perfect fifth. That was 3x the frequency. This is actually a "high fifth" or a 12th. To get the fifth, you "bring it down" to the original octave by dividing it by 2. So you have the a perfect fifh of 1.5x the frequency. We can build a scale with this!
Let's start with F, because it's convenient.
If you start going through the circle of fifths, after 4 jumps you have this scale:
F - C - G - D - A
If we rearrange it:
F - G - A - C - D
Which is F major pentatonic... nice! I think that the pentatonic scale was widely used antiquity, before the diatonic scale was invented, but that's just from a conversation I had with a musician friend, so I don't have a reference for this. Of course, it's still alive today.
If you jump 2 more steps, you have:
F - C - G - D - A - E - B
If you rearrange these, you get
C - D - E - F - G - A - B
Which is C major... nice!
If you keep jumping through the whole circle of fifths, you end up with the full chromatic scale.
But back then the scales used what we call "perfect intervals", so a set of frequencies derived from perfect frequency ratios. This yielded a scale that didnt "wrap around itself" nicely. There are other stack exchange questions that explain why this happens. Let's just say that no power of 1.5 will ever yield a power of 2.
In the past, notes that we consider enharmonic nowadays (like A# / Bb) actually sounded different because of that. This led to problems playing some fretted/keyed instruments in different keys.
Equal temperament (or 12-TET) was created to solve this issue. Each interval is adjusted to be slightly off-key with the so-called "perfect scales", but we end up with a scale that wraps around itself nicely, enharmonic notes, and instruments that can be played in virtually any key. There is an extensive explanation in this answer AFAIK, Bach pioneered the introduction of a tempered tuning in Western music with the Well-tempered clavier. However, it appears that Bach's tempered tuning was not what we call 12-TET nowadays, but just a different type of temperament.
Some people have called 12-TET either "the death of Western music" or the "the single biggest achievment of Western music".
Equal temperament was adopted at some point, but before it, just intonation was used in tonal western music, being a system that produces more in tune intervals at the expense of being more suitable for given key(s). In "Das wohltemperierte Klavier", Bach demonstrated the "new system" suited all keys just the same, unlike the just intonation tuning.