How to keep your laptop on when the lid is closed on Windows 11
This tutorial will show you step by step how to keep your laptop on when the lid is closed on Windows 11.
After changing this setting, you can keep downloading and working with an external monitor when the laptop's lid is closed without putting your PC to sleep.
Steps
1. Click on the Windows start menu button or search icon.

2. Type lid.
3. Click on Change what closing the lid does.

You can also type control panel > click on Control Panel > Hardware and Sound > Power Options > Choose what closing the lid does or Choose what the power buttons do in the top left corner of the “Power Options” window.
4. At When I close the lid, you click on the selection menu buttons and select Do nothing.

5. Click on the Save changes button at the bottom of the window.

That's it. From now on, your laptop should stay on when you close the lid.
You can test it out by plugging your laptop into a TV or external monitor and closing the lid.
Related:
How to disable your PC's power button in Windows 10 and 11
How to stop Windows 10 or 11 from turning off your screen
References:
https://www.howtogeek.com/822524/how-to-keep-your-laptop-on-with-the-lid-closed-on-windows-11/