A more detailed reason for why your horse might not appear in the city when you fast-travel, whilst it does at other times, might depend on what city you travel to. In the Major Holds - Solitude, Markarth, Whiterun, Windhelm and Riften, your horse can be found in the stable, as horses aren't allowed to pass through gates. Whereas in the Minor Holds - Morthal, Falkreath, Dawnstar and Winterhold are outside cities with no real gates. In a way the Major Holds are treated more as open dungeons, dragons can attack you, followers can follow you in to it, but horses cannot, like in many dungeons.