Well you detect all the units you want to respawn.
Then for each of them you save their position and rotation in 4 variable arrays (unit type, X,Y and rotation).
You then store the array index on the unit via the handy custom value natives that enable one to store an integer on a unit.
When a unit dies, you get the custom value of it and store it in a local, you then wait your respawn time (polledwait recomended for better accuracy) and then create a new unit from the stored value and your arrays and then reattach the index to it so the cycle can repeat.