Dumbledore said that James had left the cloak in his possession, but nowhere in the series is it explained why he had left it.
In the letter from Lily to Sirius, she said that James couldn't have used it since Dumbledore had it already.
'You. You have guessed, I know, why the Cloak was in my possession on the night your parents died. James had showed it to me just a few days previously. It explained much of his undetected wrongdoing at school! I could hardly believe what I was seeing. I asked to borrow it, to examine it. I had long since given up my dream of uniting the Hallows, but I could not resist, could not help taking a closer look ... It was a Cloak the likes of which I had never seen, immensely old, perfect in every respect ... and then your father died, and I had two Hallows at last, all to myself!'
Harry Potter and the Deathly Hallows - p.572 - Bloomsbury - Chapter 35, King's Cross
Count as somewhere in the series where it is explained why he had left it?
Dumbledore wanted to see if James's cloak was the fabled cloak of the Deathly Hallows.
We learn about the Invisibility Cloak and its origins in the Pottermore article here.
Linfred’s eldest son, Hardwin, married a beautiful young witch by the name of Iolanthe Peverell, who came from the village of Godric’s Hollow. She was the granddaughter of Ignotus Peverell. In the absence of male heirs, she, the eldest of her generation, had inherited her grandfather’s invisibility cloak.
The Peverell name is one that is most deeply associated with the Deathly Hallows.
From this time on, the cloak was handed down to the eldest in each new generation.
Now from this quote we can surmise that the cloak never faded in its ability to render the user invisible, whereas other normal invisibility cloaks do.
And to cap it all off
James Potter then inherited Ignotus Peverell’s Invisibility Cloak.
It is likely Dumbledore made this connection on his own, and then sought to test the cloak for its connection with the Death Hallows, which Dumbledore has had a longstanding and dangerous obsession with. For example the Horcrux ring, he only put this on because of the resurrection stone mounted on it.
JKR once mentioned this as a "Never-Asked Question" (one she'd never been asked in interviews), and attached great significance to it:
there IS a question I've always been surprised nobody's put to me, and that I really should have said it while I was still on-stage. I can't make amends to the girl who asked, but it is in tribute to her that I give the answer, belatedly.
Why did Dumbledore have James' invisibility cloak at the time of James' death, given that Dumbledore could make himself invisible without a cloak? There IS a significant - even crucial - answer. (www.jkrowling.com 9/13/06)
Note that she said this before HP and the Deathly Hallows was published, so it's likely the answer is somewhere in that 7th book. The obvious answer is that Dumbledore wanted to study the Cloak because it's one of the three Deathly Hallows. This idea is supported by the (admittedly unreliable) Harry Potter Wikia:
Around the time that Lord Voldemort was hunting the Potters for their son, the Cloak of Invisibility came to the attention of Albus Dumbledore when James showed him the Cloak, and Dumbledore, who had searched for the Deathly Hallows in youth, asked to borrow the Cloak from James to study it. After James was killed, the Cloak was left in Dumbledore's possession.