Ok I fixed it: after trying everything I could read everywhere, the solution for me was very simple and strange:
I pulled the usb-c thunderbolt cable out of my second screen, then flipped it (so the usb-c thunderbolt that was in the MacBook go into the screen, and the side that was in the screen, I put into the MacBook), and then it worked again.
I'll also list other possible solutions that worked for other people, maybe it works for you (it didn't for me):
1. Disconnect and Reconnect All Devices:
• Shut down your Mac and disconnect all peripheral devices, including your external monitor.
• Wait for about 5 minutes.
• Reconnect your external monitor and other devices, then start your Mac.
• This method has been effective for some users experiencing similar issues.
2. Reset NVRAM/PRAM:
• Resetting the NVRAM/PRAM can sometimes resolve display-related problems.
• To do this, restart your Mac and hold down the Option, Command, P, and R keys simultaneously for about 20 seconds.
• Release the keys and allow your Mac to continue starting up.
• This process can help with various hardware-related issues.
3. Detect Displays Manually:
• Go to the Apple menu and select “System Settings.”
• Click on “Displays” in the sidebar.
• Press and hold the Option key to reveal the “Detect Displays” button, then click it.
• This can prompt your Mac to recognize the external monitor.
I hope one of these solutions works for you. Good luck!