There are two very useful books on the subject - Surveillance Tradecraft by Peter Jenkins, and Close Protection by Richard J Aitch. Read those two and you should have no problem surveilling or following someone whilst remaining undetected, and similarly no problem in not being surveilled/followed.