Turkey wont hand over S-400 technology to the US because they will depend on the S-400 for their defence for several decades to come and have no interest in seeing the technology overcome by anyone.
The fact of the matter is that the S-400s in foreign hands will be far easier to defeat than those in Russian service simply because the S-400s in Russian service have the full spectrum of support and force multiplying equipment and systems to make them even more effective than on their own.
Think of it in terms of law enforcement... give a man a gun and a badge... it pretty much makes him equal to any bad guy with a gun without a badge. Give the man with the badge a radio and the capacity to call for backup and suddenly he is much better off... give him helicopters and dogs and swat teams and even a group of criminals don't have a chance... it is the same guy, but things like a radio and backup when needed as well as better armed and better armoured Swat members means he has force multipliers he can use when needed. He wont call SWAT teams out for a shoplifter of course.
The point is that an S-400 on its own can be overwhelmed, but sensible use and other systems correctly used together mean the forces needed to overwhelm become enormous and expensive and vulnerable to pre-emptive self defence attacks before they are even used.
Russia and Turkey are not best buddies, but they have a lot of things in common and some areas of cooperation where they can both come out better than if they just spat at each other and treated each other as the enemy.
Turkey wanted Assad gone, but it looks like Assad is here to stay... and to be honest if Libya is anything to go by they really would have had more problems with him gone than with him in power. The chaos of a thousand groups all wanting power and control and not able to work together once the joint goal of getting rid of Assad was achieved was played out in Afghanistan when the Soviets were there... when they left peace did not suddenly break out... all the factions just turned on each other and there was war that has pretty much continued to this day without resolution.
Turkey needs a stable neighbour, but it does not want the Kurds to be in charge. Russia wants a stable Syria, as do the Syrians, though Assad wants to remain in power, that is not a certainty either.
Very simply Russia and Turkey and Iran would benefit from all of Syria being under the control of Assad, with Turkey, Assad and possibly Iran preferring no place for the Kurds, but with Russia not really caring either way.
If the Kurds could convince Turkey and Iran and Assad that they want peace they might be able to come to some agreement to wipe out ISIS and then look at what options are acceptable to go forward... but America doesn't want that... they want the war and the bloodshed to continue... unlike all the other countries in the region except Israel.