There are probably many different methods to refurbish and/ or recertify hard drives depending on how the drive was returned, it could be open box but unused, warranty return to place of purchase or RMA to manufacturer, light to medium use or near end of warranty period.
The actual process would be down to the company refurbishing the drive, some are done in-house others are farmed out to 'specialist' companies but can include steps like physical appearance check, basic I/O tests, updated firmware, reset SMART tables, full format, disabling heads/ platters that fail tests (resulting in a loss of capcity vs original spec) and probably many more methods.
I would think the guiding process would be effort vs costs, obviously a physical check, format & I/O check would be the ideal from a refurb for sale or warranty replacement as those steps cost the least.
As far as getting a refurb back after RMA I believe that would be covered in the warranty terms for the product along the lines of 'we reserve the right to replace, repair or refund at our discretion' or similar wording and is used by retailers and manufacturers alike.
Of course these terms would need to take account of local consumer protection laws and guidelines, such as marking products as refurb and not reselling at full price, but I think are pretty common, although there are examples of major retailers breaking these rules and being caught out.
Most of this information is anecdotal/ best guess gleaned from various tech sites and forums, I doubt most manufacturers or refurb companies would explain the process or are even required to, what matters to the end user is that they receive a working product with warranty.