If an Antivirus (ex:ESET) detects a virus inside an archive (ex: .RAR) will it automatically delete the infected file? Or would I need to delete the whole archive? (assuming the archive is not password protected)
Commonly AV detect only malware but not remove it from inside an archive. If this feature would be needed the AV would not only need to implement functionality to look into an archive but also to create a new archive, this way making the code more complex.
But, there are for example firewalls which remove malicious content from the traffic (i.e. drop attachment from mail) or even change the content by stripping macros from an office document before forwarding it.
Most modern Antivirus Software can repair a compressed File containing a Virus.
Often this option is turned off due to the length of time it adds to each Scan (or only the Initial Scan, a feature offered by a few Programs). The Checkbox 'Scan on Demand' will detect the Virus at 'unpacking time' (often with updated Antivirus Definitions, and Engine) and save time with a better Detection Rate.
The 16 year old answer is "yes": https://www.symantec.com/connect/articles/infectable-objects-part-four-viruses-archive-files-and-compressed-files - in the past decade great improvements have been made on both sides; at the very least deletion of the viral files within the Archive is possible and deletion of the whole File is unnecessary.