This answer is from an LDS perspective.
James E. Talmage wrote Jesus the Christ which contains an in-depth look into Jesus' life and contains answers to your questions. In answer to the first question, the answer is because He had to and did allow His spirit to leave.
A natural effect of [Jesus’s] immortal origin, as the earth-born Son of an immortal Sire, was that He was immune to death except as He surrendered thereto. The life of Jesus the Christ could not be taken save as He willed and allowed. The power to lay down His life was inherent in Himself, as was the power to take up His slain body in an immortalized state.1
Further on he says:
Fully realizing that He was no longer forsaken, but that His atoning sacrifice had been accepted by the Father, and that His mission in the flesh had been carried to glorious consummation, He exclaimed in a loud voice of holy triumph: “It is finished.” In reverence, resignation, and relief, He addressed the Father saying: “Father, into thy hands I commend my spirit.” He bowed His head, and voluntarily gave up His life.
Jesus the Christ was dead. His life had not been taken from Him except as He had willed to permit. Sweet and welcome as would have been the relief of death in any of the earlier stages of His suffering from Gethsemane to the cross, He lived until all things were accomplished as had been appointed.2
He goes on to say:
Christ, the great Passover sacrifice, of whom all altar victims had been but suggestive prototypes, died through violence yet without a bone of His body being broken, as was a prescribed condition of the slain paschal lambs.2
Which refers to John 19:31-37 (and the OP referenced)
31 The Jews therefore, because it was the preparation, that the bodies should not remain upon the cross on the sabbath day, (for that sabbath day was an high day,) besought Pilate that their legs might be broken, and that they might be taken away.
32 Then came the soldiers, and brake the legs of the first, and of the other which was crucified with him.
33 But when they came to Jesus, and saw that he was dead already, they brake not his legs:
34 But one of the soldiers with a spear pierced his side, and forthwith came there out blood and water.
35 And he that saw it bare record, and his record is true: and he knoweth that he saith true, that ye might believe.
36 For these things were done, that the scripture should be fulfilled, A bone of him shall not be broken.
37 And again another scripture saith, They shall look on him whom they pierced.
While Jesus didn't die because He was in worse shape, He was still in worse shape as He was finishing the majority of the Atonement and had just:
11 For, behold, the Lord your Redeemer suffered death in the flesh; wherefore he suffered the pain of all men, that all men might repent and come unto him.3
1 https://www.lds.org/manual/jesus-the-christ/chapter-25.p48?lang=eng&_r=1
2 https://www.lds.org/manual/jesus-the-christ/chapter-35?lang=eng
3 https://www.lds.org/scriptures/dc-testament/dc/18.11?lang=eng