Well there are two types of aimbots, external and internal...Externals are slower but safer on detection than the faster internal ones.
Both types read the game to find out the location of the enemy to your position, if they are visible, it calculates the view angles to the enemy and applies it to the game. The main difference is in speed as the external aimbots use alot of CPU power than the internal but is still slower. The other differences is that internal aimbots can take advantage of things like "Auto-Wall", "No-Spread (Non-Host kind)" and many more features as it has direct access to the engine.