What Bruce said. Max rate is strongly rated to age, but genetics, health, and conditioning are factors. Simple formula is

MaxHR = 220 bpm - Age (yrs). For a 50-yr old that's 170 bpm. That doesn't mean you'll drop dead at 171, it's related to your maximum aerobic capacity to exchange O2 and CO2.

Target HR (as a percentage of MaxHR) can vary a lot with your condition level and length of workout. I warm up at 120 and then 125-135 for a sustained cardio/calorie burn type workout depending on how I feel. For weight loss, a lower HR workout for longer is more effective.

My wife got me into doing High Intensity Interval Training (HIIT). Repeated cycles of high bpm / recover at low bpm. Science shows this is highly effective especially if you're in good shape and want to improve. You can this with timed cycles or by hitting a high target heart rate and then slowing down as fast as possible for a short recovery.

My wife uses a special variant of this in her spin classes called Tabata Protocol, which is 8 rounds of 20 seconds full out and then 10 seconds rest. A treadmill can't adjust that quickly, but you get the idea.