Back when i went through Malware school to become a Malware Specialist this was the code we were taught !
- Refresh your PC
- Reset your PC
The first will re-install your operating system, but keep your personal files and settings, the second will both re-install your operating system and remove your personal files and settings. The second is the safer (but less convenient) option.
When an infection infects your computer, it does so by installing malicious files and processes and registry settings, so if you reset your computer to how it was when your OS was first installed, you will by default remove any changes that an infection might have made.
Now technically it is possible to infect the firmware on your computer, and since this boots before your OS, then it will survive a reset. However, infecting firmware is extremely difficult to do, and usually requires hands-on access, so unless you have allowed someone to have unsupervised access to your machine, it is highly unlikely that you will ever contract one.
From time to time you might read of some "new" method to infect firmware remotely, but I've been helping people remove infections on other forums for 20 years now, and I've yet to see anyone with a real firmware infection.
Don't use a "smartphone" myself, so can't say what's possible with them, or what reset options are available. I expect it will depend on what make of phone, and what OS it's running, but I would imagine that a phone reset would operate in a similar manner to Windows, and be equally effective at removing infections.
The one last thing to consider, is whether you have multiple devices which are synced, in which case if more than one of your devices has been infected, then after a reset your machine can become re-infected when it syncs with one of the other infected devices.