Why did Syria allow the Russians to set a naval base in their country knowing full well that this would make them a prime target for the U.S.? Did Syria gain anything from letting Russia use their country as a geopolitical chess piece? I am thinking there's more to it, because I don't see it as a win-win for Syria in any way.
During the 1960s-1980s, Syria was Soviet-aligned and massively armed with USSR weapons. Look at the Yom Kippur war, for example Valley of Tears
The actual number of Syrian tanks was about 1,260.
The Syrians attacked the central sector again at 22:00 with artillery. The 7th Division was joined by the 64th and 66th Field Artillery Regiments with the 81st Brigade, led by T-62 tanks
Oh, and also look up what the Baathist party ideology is: pretty much "Arab Communist strong-arm party".
The Russian naval facilities date from that time. Past the USSR collapse, Syria remained in Russia's sphere of influence. Simples. In fact, many people figure Putin came so strongly to Assad's help to keep that base just the way Russia likes it.
Lots of initially similar situations in Arab countries: Egypt was Soviet-armed, but then got inducements to sign a peace treaty with Israel and switched to Western weapons. Iraq remained Soviet-armed, Baathist, and Russia-friendly, but got some nice French and German weapons, on credit, to fight Iran.
Libya too was a type of "Revolutionary Arab Socialist Republic", USSR-friendly, which was popular with Pan-Arabists at the time for some reason.
Syria however had some skeletons in its closet at Hama that made it hard to like with its relatively limited oil reserves so it had to stick with the friends it had.
Did Syria gain anything from letting Russia use their country as a geopolitical chess piece? I am thinking there's more to it, because I don't see it as a win-win for Syria in any way.
This deal was a classic and elementary quid pro quo.
Russia has provided military aid, weapons, Russian troops and a major diplomatic ally in support of the main Syrian regime in its current, not entirely over, civil war since 2015.
As a result, the Syrian regime was in no position to deny Russia military base concessions that it sought, such as this one, in 2017, right in the middle of the Syrian civil war when it the regime was relying upon Russia for its very continued existence.
The decision may also make sense for Russia.
The answer from @ItalianPhilosophers4Monica provides some general 20th century historical background that suggests why this was a natural choice for Syria to make when the Syrian civil war (which U.S. diplomats encouraged) broke out, even though the proximate cause for this decision by Syria was Russian backing for its regime in Syria's civil war.
But, Russia's decision to provide military and diplomatic backing for Syria in exchange for more foreign military bases near the chokepoint at which its Black Sea fleet accesses the Mediterranean sea and potential cooperation in exporting its oil resources, might have made strategic military sense for Russia, even in the absence of its history of a reasonably positive relationship with Syria during the Soviet era.
Why did Syria allow the Russians to set a naval base in their country knowing full well that this would make them a prime target for the U.S.?
This deal has the practical effect of probably triggering Russian aid for Syria in the future if the U.S. or another country attacks it (as the U.S. has previously done in the current Syrian civil war in connection with the use of chemical weapons by the Syrian military against civilians in rebel held territory of the country). Indeed, since Russian has nuclear weapons, this basing arrangement provides Syria with an indirect nuclear deterrent it could not obtain in any other way.