First and foremost, it's important to note that DaVinci Resolve 18 currently does not offer a straightforward method to rotate your entire project upon export. Therefore, I am presenting a free third-party solution using the command-line version of ffmpeg.
In this usage example, ffmpeg changes only the metadata, which means your export will not be re-encoded, and you will not lose any quality.
Please avoid workarounds such as inserting your horizontal timeline into a new timeline with a vertical aspect ratio, or re-encoding the final export with tools like HandBrake. These methods will lead to a loss in quality.
After downloading ffmpeg from here, unzip it and copy ffmpeg.exe to your preferred location.
Open your preferred console and navigate to the directory where you placed ffmpeg.exe. Use the following command to rotate your video 270° counterclockwise, replacing input.mp4 with the name or path of your exported video file:
ffmpeg.exe -display_rotation 270 -i input.mp4 -codec copy output.mp4
The ffmpeg command was sourced from Stack Overflow. It has been successfully tested with a horizontal .mp4 video, rotating it 270° to transform it into a vertical format suitable for uploading to Instagram.