This blog post provides suggestions for getting a second monitor working on Linux, specifically Ubuntu 20.04.4 LTS on a Lenovo Legion 5 Pro 16ITH6 with (I believe) an Nvidia RTX 3050 4GB GDDR6 video card.
In preparation for Windows 11, I am trying to migrate to Linux. For unknown reasons, the laptop screen was working, but the machine did not seem to recognize the external monitor connected by HDMI. In Ubuntu, Under Settings, the Displays listed only the laptop screen, not the monitor. The monitor never seemed to receive a signal from the computer.
I am not sure exactly what fixed it, but I ran the following:
sudo apt-get update
sudo ubuntu-drivers autoinstall
sudo apt install nvidia-prime
sudo prime-select nvidia
I have a feeling that it may have been sudo apt install nvidia-prime, because afterwards, when I ran sudo prime-select nvidia, it output:
Info: the nvidia profile is already set
And at that point the monitor started working.