At level 1, your hit points are the maximum of your class’s hit die plus your Constitution modifier. A level-1 fighter (d10) with 14 Constitution (+2) starts at 10 + 2 = 12 HP.
At every level after that, you add either the average of your hit die (rounded up) or a fresh roll (try it in the dice roller), plus your Constitution modifier again. The averages are d6 → 4, d8 → 5, d10 → 6, d12 → 7. HP is cumulative — you keep everything from earlier levels. Hit points are one step of leveling up in 5e; that page lists the rest.
Your hit die is set by class (see the table), and you get one per level to spend on short rests — the hit dice calculator shows how much they heal. If your Constitution modifier changes, the bonus applies to every level you have, so raising Constitution boosts your maximum HP retroactively — a +1 to the modifier adds 1 HP per level. The Tough feat adds another 2 HP per level. Write the result in the Hit Point Maximum box of your printable D&D character sheet. When damage drops a character to 0 hit points, they fall unconscious and start making death saving throws.
For the full level tables and hit dice by class, see the Cleric, Paladin and Warlock class guides.