First of all, you need to make sure that the required Upgrader is placed on your farm and the corresponding machine or animal is on the Upgrader. After that tap the big yellow arrow icon in the bottom right of your screen and select the upgrade icon . Here you can see all your Upgraders and check the level and upgrade requirements of each Upgrader.
Tap the magnifying glass icon next to the animal or machine your Upgrader belongs to. You’ll see a list of all the Gadgets you can place on this specific Upgrader. Scroll down and/or to the right to find the Gadget you want to purchase. Double tap the Gadget, and you will see the price button. Tap it to buy the Gadget.