(Note: creating 4k portrait mode timeline resolutions is only possible with the paid version, Resolve Studio. You can find a workaround for the free version of Resolve at the bottom of this article.)
If you filmed your clips natively in a portrait mode (vertical), create a timeline matching the source resolution like 1080 x 1920 or 2160 x 3840 (Studio version only):
If you have clips that need to be oriented vertically, select them in the media pool, right-click, choose 'clip attributes' and select 'image orientation' 90 degrees left or right:
Once you're ready to export, choose the respective h264 bitrate requirement for the resolution you are working with (for example, 20Mbps/1080p or 45Mbps/4k) from the Deliver page:
What if I'm using the free version of Resolve?
A workaround to export 4kUHD vertical videos from the free Resolve version is to export in a horizontal (landscape) orientation using a high-quality codec like Apple ProRes 422 or DNxHR HQ and then orient them vertically using a third-party encoder like Shutter Encoder:
Check out the video tutorial here for a step-by-step process (starting at 3:08):