I have a relatively new Thinkpad X1 Carbon with Ubuntu 20.04. Usually, I use it in a docking station, but will frequently have to take it out to change offices for video conferences etc. This leads to frequent charging processes even though the battery is still missing only a few %. Will this hurt battery live in the long run, and is there anything I can do to optimize the battery life?
Lithium-ion batteries have no "memory effect", so there's no advantage to fully discharging or fully charging. At least, there's no advantage for the battery. But laptops or their battery management systems do sometimes benefit from a full discharge and charge, but only to re-calibrate their monitor so it gives you an accurate percentage of remaining battery power. Don't do that very often, though.
The best things you can do to prolong your battery is:
If a lithium-ion battery is discharged below 2.5 volts per cell, a safety circuit built into the battery opens and the battery appears to be dead. The original charger will be of no use. Only battery analyzers with the boost function have a chance of recharging the battery.
Also, for safety reasons, do not recharge deeply discharged lithium-ion batteries if they have been stored in that condition for several months.
Unlike NiCad batteries, lithium-ion batteries do not have a charge memory. That means deep-discharge cycles are not required. In fact, it's better for the battery to use partial-discharge cycles.
There is one exception. Battery experts suggest that after 30 charges, you should allow lithium-ion batteries to almost completely discharge. Continuous partial discharges create a condition called digital memory, decreasing the accuracy of the device's power gauge. So let the battery discharge to the cut-off point and then recharge. The power gauge will be recalibrated. (https://www.techrepublic.com/blog/five-apps/five-tips-for-extending-lithium-ion-battery-life/)
For more details about ways to save power, please also consult: https://wiki.ubuntu.com/Kernel/PowerManagement
Aside from that, your battery will eventually wear out. Lithium-ion cells have around 500 cycles on them, before they're significantly degraded. Even if you don't use them, aging will eventually wear them out, but that takes a long time. I have 10 year old laptop batteries that still have 80% of their rated capacity. If good cells are used in the laptop battery, they'll last. Of course, you don't really know what cells are used unless you break the battery pack to take a look.