There were no witnesses, except for Harry, who was still a baby and didn't relive / remember the experience until much later. James and Lily were both dead, Voldemort was not quite dead but not much better and not likely to tell anyone what happened.
So how did Dumbledore, or anyone, know that Lily sacrificed herself for Harry?
Keep in mind that even finding out what happened in a more general sense, that James and Lily had died and Voldemort had been killed by a rebounding killing curse, was difficult enough.
Of course, it would be clear they had died defending their family, themselves and Harry, but nothing found at the scene would have told anyone that Lily had been given the choice to live, but did not take it. Perhaps James had been given the same choice, but declined as well. Or — less likely — perhaps he was the only one given the choice, while Lily was killed right away.
Yet Dumbledore seems to have known, as shown in this quote (emphasis mine):
But I knew, too, where Voldemort was weak. And so I made my decision. You would be protected by an ancient magic of which he knows, which he despises, and which he has always, therefore, underestimated — to his cost. I am speaking, of course, of the fact that your mother died to save you. She gave you a lingering protection he never expected, a protection that flows in your veins to this day. I put my trust, therefore, in your mother’s blood. I delivered you to her sister, her only remaining relative.
She may have taken you grudgingly, furiously, unwillingly, bitterly, yet still she took you, and in doing so, she sealed the charm I placed upon you. Your mother’s sacrifice made the bond of blood the strongest shield I could give you.
Order of the Phoenix, Chapter 37. Thanks to Anthony Grist for pointing out.
Here, Dumbledore talks about Lily's sacrifice, specifically her sacrifice, not just dying defending him, like what happened to James. Since Harry is delivered to the Dursleys within 24 hours, Dumbledore must have found out within that time span. And he must have known with enough confidence to base the entire protection of Harry upon that fact.
Slytherincess pointed me to a related question of hers, in which she asks how Voldemort knew about this type of magic (JKR's books and interviews seem to contradict each other there). But what I want to know is how it was found out what happened, with such detail that Dumbledore knew Lily had sacrificed herself.
This question has been asked on Quora, however, I can't read beyond the first answer there and even if I signed up to read all answers, from what I've heard, Quora doesn't seem to be the most reliable source.