As others have mentioned, what you have shown are common tactics (the pin and the fork) which are used to win material, generally based on a double attack, only one component of which you can answer. There are other tactics as well, including the discovered attack, x-ray attack (skewer), deflection and overloading. Often tactics are conjoined in a combination. It would be advisable to familiarize yourself with these from either an electronic or printed source, of which there are many available. In addition to these tactical patterns, you should also familiarize yourself with the common checkmating patterns so you can recognize them when they arise. These would include the Scholar's Mate, Fool's mate, Legal's mate, Philidor's Legacy (smothered mate), Morphy's Mate, Dovetail Mate, Epaulette Mate, and quite a few others, all of which can be found in the same sources as the tactics. Then regular play helps you to see any of these when they are imminent so you can react in time.