[RPG] How to determine hit points in 5e for custom monsters

dnd-5ehit-pointsmonsters

Before anyone says it, I did look in the DMG. The table listed there is, as far as I'm concerned, completely useless if one's starting from a certain CR. The hit points column puts down a range of hit points that's way above the range I see in actual monsters of the listed CR in the MM. CR 1 has its hit point range as 71-85, but not a single monster I'm seeing has hit points in that range. So how do I determine hit points? What are the rules for it? How does CR correlate to hit points if the table doesn't list that?

Give it levels in a class for the purpose of determining hit dice.

This can also be raised up to whatever maximum of levels you need, and the hit dice can also be whatever makes sense. The highest monster in the MM is the Tarrasque with 30d20 hit points, and 30 Constitution.

Or... calculate the average amount of damage your party deals per turn, and scale the difficulty based on how many rounds you want the combat to last.

The longer the combat, the harder it is for the adventurers to fight. Say that given all attacks hit (calculating AC is outside the scope of this question), your adventurer party deal a given amount of damage a round on average in total. You would multiply said given amount of damage by how long you want the encounter to last in rounds (based on your party's total hit points and how many hit points of damage your monster deals on average given it hits). If you want to even more accurately do this, calculate the probability both the party and the monster hit their attacks given their average AC.

Or... make it up, and using trial and error see what works and what doesn't.

Do make sure not to slaughter the party if you decide to take this approach.

As for the last part of your question... the Challenge Rating has no direct correlation to hitpoints. Rather, it is a combination of features of the monster including hit points, AC etc. For example, a monster could be fairly weak by first looking at just its AC, hitpoints and damage, but it could have other features which make it very difficult to fight.