That depends on the license, but in the case of the GNU GPLv3, this is what it says about termination (sec. 8):
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
This means that you're usually allowed to fix the issue by doing whatever it takes to repair the violation after you've discovered your mistake. There are some other terms (depending on whether this is your first time transgression or not), but the gist is that a good-faith violation is repairable, and if you're able to repair, you can go on using the licensed materials.
The GPLv3 does not oblige you to inform the copyright holder (but other free software licenses may - read the license text).
If you're not able to repair (for instance, you're distributing GPL code as part of an unfree project), then you need to stop doing it, delete the files, issue a recall to your customers, and probably: hire a lawyer to help you sort out the mess.