What is the optimal way to draft in a group of two cyclists? How often should a person on the front get off and go behind the person in the back when there is only a group of two? Every minute? Every 10 minutes? When there are several people, a paceline is quite straightforward, but I don't know what would be the equivalent with two people.
Do you both have a speedo on your bike's handlebars for reading the current velocity, (ie speedometers/head units/bike computers/) ?   It can be very hard to ride on feel, so one of the better ways to pace a group is to pick a target speed that is not flat-out, and the lead should aim for that speed.
When the leader feels its time to rotate, then you gently swap places.  The new lead should work to maintain the nominated speed, and not blast away from the now-tired other rider.
How long apart is this?  It depends on how long each person can maintain the nominated speed while on the front, and how long you each need on the back to recover for your next pull.
If you find you're holding that speed for multiple minutes and not getting tired, then perhaps you want to raise the target a couple of km/h.  Or you might be advantaged by a slight descent or a good tailwind.
Likewise if you're not getting enough shelter on the back before its your turn again, then perhaps the target speed was too high for this day, and knocking it back by 2~3 km/h would help.  Some-days you just don't go as fast, its okay.
If the group were bigger, you'd have up to about 6 riders in a single paceline, where the front one gets tired and then peels off, drifting back down the line and leaving a fresh new face to take the wind.  Tired rider has to kick it up again to hook onto the back end, but there will get a good wind saving.
Your two-person paceline is a bit too short for a casual drift back and recovery, but still its up to the leader to make a decision when to peel off and drop back.
Aside - more than about 6 riders and you have enough for a nice double-paceline, where the rider drifting back isn't just on their own, they're in a second line which slowly drops back and then across into the forward line.   Imagine a paternoster lift slowly revolving around.