Just to add a few things from my observations,
Accuracy increases pp exponentially (or by some hugely increasing amount) the closer you get to 100%, and higher OD increases that scaling further. You can look at pp awarded to DT plays of different accuracy on the same map depends so heavily on the accuracy, like an SS awards 60% more pp than 96%. This is because DT increases OD a lot.
Also I believe they don't look at accuracy so much as the number of 300s, 100s, 50s, and misses you got compared to the total amount of objects. Misses, no matter where they occur in the combo, are detrimental to the play's pp gain. It would always be better to get several 100s rather than a single miss, anywhere in the map (so the combo is equal), even if several 100s gets lower accuracy. Most of the time we're talking about full combos with no misses, so accuracy and number of 100s can be talked about interchangeably.
Similarly, the system doesn't look at your score at all. Rather it uses your maximum combo in that play and compares it to the highest possible combo of the song. Not sure how the scaling works, but this would mean that other smaller combos you got during the play (if it wasn't a FC) don't matter.
If these previous two things are true, that means all the information about a play needed to determine its pp worth is available on the post-play scoreboard. Your actual replay isn't necessary at all (and that's why replays aren't saved online unless it's like somewhere in the top 50).
I don't think OD and HP drain affect star rating. Star rating is determined by the objects in the map and how physically difficult it is to hit them: how fast and precisely you have to move your cursor (aim), how often you have to click (speed). It's primarily determined by the hardest parts of the map. You can experiment in the editor, making difficulty spikes easier or harder and see what it does to the star rating.
Length of the map isn't its actual length in time but its number of objects. Circles seem to be more important since they can affect accuracy. Apparently Super Nuko World Guy's Extra is popular among pro players who can stream well because it has a lot of streams for its length in time.