Taking out a Titan in Titanfall is no simple feat. Needless to say, it’s most easily accomplished when you’re in a Titan yourself, provided you know what you’re doing.
The first thing to do is to whittle down the enemy Titan’s health by shooting it in the head and back on the red spots with your primary weapon, and firing off your Slaved Missiles or deflecting rockets fired upon you back at the enemy.
And now for the kill: once your enemy Titan enters “Doomed Mode”, which is when the enemy's health bar goes critical, you’ll want to get in close for the kill instead of continuing to shoot it from afar as that will not net you the kill for the enemy Pilot, who will more than likely safely eject before his Titan blows up. As I mentioned, you’ll want to go in straight for the kill by entering melee range and punching the enemy.
You can watch the following video by Blucky, which explains with clarity on exactly how to kill a Titan.