When giving students a second opportunity to demonstrate mastery on a major summative assessment, I quickly learned my middle schoolers needed more structure that just the opportunity to retest. They would come to the second testing session no better prepared that the first time and usually score the same or lower.
What's worse is when I started offering retests a few years ago, I noticed student preparation for a test dropped substantially. The first test didn't "count" because of the retest "safety net". Whether they actually bothered to retest was a different story.
Therefore, I started requiring some work to be completed before being allowed to retest. I wanted to teach students they needed to prepare more or differently, and well as give them the support steps to do so. I also wanted to discourage students as seeing retesting as the "lazy option". I wanted them in the driver's seat.
My process and form has changed over time, but this is what I use now.