If your iPad is stuck in the vertical screen, you can try the following solutions:
Restart your iPad: Press and hold the Power button until the "slide to power off" slider appears. Slide the slider to turn off your iPad, then press and hold the Power button again until the Apple logo appears.
Check the Orientation Lock: Swipe up from the bottom of the screen to access Control Center, and look for the icon that looks like a lock with a circle around it. If it's highlighted in white, tap it to turn it off.
Check the Side Switch: On some iPad models, the side switch above the volume buttons can be set to either lock rotation or mute. Check if the switch is set to lock rotation, and if so, flip it to the other position.
Reset All Settings: Go to Settings > General > Reset > Reset All Settings. This will reset your iPad's settings to their default values, but won't delete any of your data.
Restore your iPad: If none of the above solutions work, you can try restoring your iPad to its factory settings using iTunes on a computer. This will erase all data and settings from your iPad, so make sure you have a backup of your data before proceeding.
If the issue still persists after trying all of these solutions, it might be a hardware issue, and you should contact Apple Support or take your iPad to an authorized service provider