In 1962 Pakistan was not politically / diplomatically prepared to militarily annex Kashmir .
In fact Pakistan was even prepared to help India to jointly face the Chinese threat ,
Further , Pakistan was then an Alliance partner of USA .USA had directed Pakistan not to open another front against India .
————————-
India , Pakistan , Chinese relations changed very dramatically after 1962
Pakistan under the guidance of Bhutto struck an anti deal with China whereby , inter alia , Pakistan gifted 5000 sq km plus of POK-i.e. Shaksgam Valley to China .
By 1965 , Pakistan had China as an ally .
Kennedy was gone in 1963 .
Also , most important for Pakistan’s 1965 Indian attack decision Nehru had also died in 1964.
Pakistan though that the new Indian Prime Minister , Lal Bahadur Shastri was a weak and indecisive leader and lacked stature especially when compared to Nehru.
PM Lal Bahadur Shastri ‘s weak personality image was further bolstered by PM Shastri ‘s , sort of appeasement of Pakistan in the Rann of Kutch crisis in early 1965
Most important factor for Pakistan ‘s decision to attack India in Kashmir in1965 was that after her defeat in 1962 India had started expanding exponentially her armed forces both in numbers and equipment.
Pakistan felt that if delayed further Pakistan , which was militarily superior to India till then , would never be able to wrest Kashmir from India.
So ,Pakistan attacked Kashmir calculating that a weak Indian PM would keep the war limited to Kashmir.
But PM Shastri with totally unexpected resolve , bravery and decisiveness .He counter attacked Pakistan across the International Border in Punjab forcing Pakistan to withdraw its forces from the Kashmir front and to , later , accept a ceasefire .