Update your iPad to iPadOS 17.1 or later (Settings>General>Software Update)

Update your Mac to macOS 14.1 or later (System Settings>General>Software Update)

Sign both devices into your Apple ID

Connect both devices to the same Wi-Fi network

Turn on Bluetooth for both devices

Have the iPad within 30 feet of your Mac

On the Mac

-Open System Settings, search for Handoff, click on Allow Handoff, and turn on the option to Allow Handoff

-In System Settings, search for Universal, click on Universal Control (under Displays), turn on the options that are circled in the picture below, and click Done.

From your Mac, attempt to use the iPad as a second display by clicking on the AirPlay/ScreenMirroring menu and choosing your name from the list. If it tells you that two-factor authentication is not turned on, restart both the iPad and the Mac. If attempting to Sidecar with the iPad still gives you the notice about two-factor authentication, then sign out of your Apple ID on the iPad, sign back into your Apple ID on the iPad, and restart the iPad once more.