Since part of any online game, namely the game world around you, must be processed on your gaming device to display it to you, this graphic memory can be scanned for certain objects, even if they are hidden behind walls, allowing the aimbot to acquire targets outside of the field of view and shoot them when they become hittable/visible. While aiming automation is straightforward, finding targets is not. It's a wallhack/VAC/ESP and game bot mixed.
A real full-fledged aimbot is an advanced cheating program that uses game hacking techniques and automation or 'bot' software to find enemies/targets by reading the game memory and finding certain objects in the game world, then locking a player's aim onto the target using user input, then shooting the target.