Bugs are unique in Kashrut as they are not subject to the rules of batel - being cancelled out - as other forbidden mixtures sometimes are:
(ג) קדרה של מרק שנפל שם בריה ונאבדה אסור הכל:
(3) Regarding a pot of soup that had a [beriah] fall into it and was lost in the mixture, everything becomes forbidden. ...
This includes any bug visible to the naked eye, even as a speck that you have to magnify to ascertain whether or not it is actually a bug
The Torah specifies 3 different types of bug, and each carries a different number of negative commandments that a person who consumes them transgresses. They are water bugs, land bugs and flying bugs.
Water 'bugs' (any non kosher fish, seafood): 4 Issurim
(י) וְכֹל֩ אֲשֶׁ֨ר אֵֽין־ל֜וֹ סְנַפִּ֣יר וְקַשְׂקֶ֗שֶׂת בַּיַּמִּים֙ וּבַנְּחָלִ֔ים מִכֹּל֙ שֶׁ֣רֶץ הַמַּ֔יִם וּמִכֹּ֛ל נֶ֥פֶשׁ הַחַיָּ֖ה אֲשֶׁ֣ר בַּמָּ֑יִם שֶׁ֥קֶץ הֵ֖ם לָכֶֽם׃ (יא) וְשֶׁ֖קֶץ יִהְי֣וּ לָכֶ֑ם מִבְּשָׂרָם֙ לֹ֣א תֹאכֵ֔לוּ וְאֶת־נִבְלָתָ֖ם תְּשַׁקֵּֽצוּ׃
(10) But anything in the seas or in the streams that has no fins and scales, among all the swarming things of the water and among all the other living creatures that are in the water—they are an abomination for you (11) and an abomination for you they shall remain: you shall not eat of their flesh and you shall abominate their carcasses.
(מג) אַל־תְּשַׁקְּצוּ֙ אֶת־נַפְשֹׁ֣תֵיכֶ֔ם בְּכָל־הַשֶּׁ֖רֶץ הַשֹּׁרֵ֑ץ
וְלֹ֤א תִֽטַּמְּאוּ֙ בָּהֶ֔ם וְנִטְמֵתֶ֖ם בָּֽם׃
(43) You shall not draw abomination upon yourselves through anything that swarms;
you shall not make yourselves unclean therewith and thus become unclean.
Land bugs (anything that crawls, eg caterpillars, maggots): 5 Issurim
(מג) אַל־תְּשַׁקְּצוּ֙ אֶת־נַפְשֹׁ֣תֵיכֶ֔ם בְּכָל־הַשֶּׁ֖רֶץ הַשֹּׁרֵ֑ץ
וְלֹ֤א תִֽטַּמְּאוּ֙ בָּהֶ֔ם וְנִטְמֵתֶ֖ם בָּֽם׃
(43) You shall not draw abomination upon yourselves through anything that swarms;
you shall not make yourselves unclean therewith and thus become unclean.
(מד) ...וְלֹ֤א תְטַמְּאוּ֙ אֶת־נַפְשֹׁ֣תֵיכֶ֔ם בְּכָל־הַשֶּׁ֖רֶץ הָרֹמֵ֥שׂ עַל־הָאָֽרֶץ׃
(44) ...You shall not make yourselves unclean through any swarming thing that moves upon the earth.

Flying bugs - flies, aphids etc: 6 Issurim
(מא) וְכָל־הַשֶּׁ֖רֶץ הַשֹּׁרֵ֣ץ עַל־הָאָ֑רֶץ שֶׁ֥קֶץ ה֖וּא לֹ֥א יֵאָכֵֽל׃
(מב) כֹּל֩ הוֹלֵ֨ךְ עַל־גָּח֜וֹן וְכֹ֣ל ׀ הוֹלֵ֣ךְ עַל־אַרְבַּ֗ע עַ֚ד כָּל־מַרְבֵּ֣ה רַגְלַ֔יִם לְכָל־הַשֶּׁ֖רֶץ הַשֹּׁרֵ֣ץ עַל־הָאָ֑רֶץ לֹ֥א תֹאכְל֖וּם כִּי־שֶׁ֥קֶץ הֵֽם׃
(מג) אַל־תְּשַׁקְּצוּ֙ אֶת־נַפְשֹׁ֣תֵיכֶ֔ם בְּכָל־הַשֶּׁ֖רֶץ הַשֹּׁרֵ֑ץ
וְלֹ֤א תִֽטַּמְּאוּ֙ בָּהֶ֔ם וְנִטְמֵתֶ֖ם בָּֽם׃
(מד) ...וְלֹ֤א תְטַמְּאוּ֙ אֶת־נַפְשֹׁ֣תֵיכֶ֔ם בְּכָל־הַשֶּׁ֖רֶץ הָרֹמֵ֥שׂ עַל־הָאָֽרֶץ׃
(41) All the things that swarm upon the earth are an abomination; they shall not be eaten.
(42) You shall not eat, among all things that swarm upon the earth, anything that crawls on its belly, or anything that walks on fours, or anything that has many legs; for they are an abomination.
(43) You shall not draw abomination upon yourselves through anything that swarms;
you shall not make yourselves unclean therewith and thus become unclean.
(44) ...You shall not make yourselves unclean through any swarming thing that moves upon the earth.

Different fruits and vegetables have different levels of infestation, often depending on time of year and where they were grown. Kashrut authorities put out guidelines for what fruit and veg are more/less problematic, here is the one from the London Beit Din:
https://www.kosher.org.uk/sites/default/files/CheckingforBugs_KLBD%20-%20A3%20Poster.pdf
UoS South Africa: http://www.uos.co.za/kashrut/Vegetables%20and%20Insect%20Infestation_CHECKING.pdf
KA Australia: https://www.ka.org.au/understanding-kosher/bug-checking
Kosharot Israel https://www.kosharot.co.il/index2.php?id=7&lang=HEB (they don't yet have an english site, but for a lot of vegetables they have a video guide)
- For regularly infested crops, it's often worth doing a pre-wash with a food-safe soap (some would say washing up liquid - I would disagree). Let the soapy water come in to contact with all parts of the leaf, moving the leaves around in the water and then pouring out the water and rinsing the leaves very well. Remove and discard any obviously sub-par leaves as they are most likely to be infested.
- Fill a white/clear bowl with warm water with about a tablespoon of salt dissolved in. The combination of the warmer temperature and saltiness loosens bugs grips on leaves and they will start to float to the surface. Move the leaves around to ensure they all have contact, and don't put too many in - aim for a 50/50 ratio. Leave this to sit for three mins.
- Carefully remove the veg, letting any water drip back in to the bowl and making sure not to take any floaters with it.
- Checking the water - first a basic visual check if theres anything floating at the top, sunk to the bottom or caught in the miniscus. If there is anything, go to step 5. If nothing obvious, get a small white plate and use it to check the water for anything small floating around. You might find things that are obvious bugs (go to stage 5), or parts of the plant that look like them - in any case of doubt, use a magnifying glass and check. If you don't find anything, the veg is assumed to be bug-free and you can enjoy it
- If you find something - drain the water, rinse out the bowl and start again from stage 2. If the second wash is clear, do a third wash to be totally sure, and then you can consume said vegetable. In general - its permitted if clean on first wash or after two consecutive washes. If you're still finding things after 3 washes, it's probably worth giving up on it and throwing it away, or giving it a pre-wash again and splitting in to smaller groups.
Supermarket 'pre-checked'/ready to eat salads can still contain a certain number of bugs so need checking anyway unless they carry a reliable hechsher. In Israel, a lot of the stuff grown in bug-free environments still says that you need to check it - check next to the hechsher