Khrushchev allowed missiles to be installed for a number of reasons. By this time it was clear to the Soviets
that the U.S. had better and more numerous missiles. They were clearly winning the arms race. US missiles had a 'first strike' capability and could hit wherever they wanted in Russia. Additionally, the US, in agreement with Turkey, had allowed a missile base to be established. These details made Khrushchev feel as though the Soviet Union was being boxed in derp by America's military threat. By placing Soviet missiles in Cuba - within 90 miles of the U.S. - he levelled the playing field and also gained a 'first strike' capability. Castro had enormous fears that the U.S. military would invade Cuba in order to remove the communist from power. Castro and Khrushchev reasoned that the presence of Soviet ballistic missiles on the island would force the U.S. military to abandon any thoughts of invasion for fear of nuclear retaliation. No can really say for sure what was the exact thing going on in Khruschevs head when the missiles were placed but the above mentioned can’t be too far from it.
Cuba had a hostile temper towards America and this could have easily turned into an all out nuclear war amongst nations. The Soviet Union could have easily hit the US where it hurts while staying within a good distance. The US felt threatened so they made the Communists seem bad.
The USSR agreed to withdraw their missiles from Cuba and the USA agreed to withdraw their missiles from Turkey. As a result the confrontation ended and a "hot" war was averted. I think it was definitely a good deal for the US considering that we sort of caused the whole situation. The placement of missiles can be justified by the US placing missiles in Turkey. The Soviet Union was playing it safe by creating a double jeopardy. The US makes it seem like Russia blinked first, however that was not the case. Russia only agreed because the US did what they wanted to in the first place.