First, before the game starts, make sure your runes are in order. Zed is a hellacious matchup for any mage, so you need to gear your runes towards early-game sustain. Consider taking Inspiration secondary for Biscuits + Time Warp Tonic for extra lane sustain and free mini-Heals, or taking Resolve secondary for Bone Plating + Demolish/Overgrowth/Revitalize. Take one damage shard and two armor shards. For your summoners, you want Flash + Exhaust. Flash is mandatory on 99% of champions, and Exhaust totally shuts down his ult.
Second, you want to build armor. Everything he does is physical damage, so armor can protect you quite a bit. If you're playing a mage, look to buy Seeker's Armguard
as fast as you can before you start building your main item, then finish your Zhonya's
once your main item is done. Zhonya's gives you another button to avoid his combos and his ult.
Even just doing those things will improve your odds against Zed tremendously.
Zed is heavily dependent on his cooldowns and skillshots. Unlike most assassins, he actually has great poke and waveclear and he can be one of the slipperiest champions in the game, but all of that power is gated behind him needing to land his stuff, and manage his cooldowns effectively. Beating him requires you to understand his kit, know when his window of vulnerability opens up, and avoid getting hit.
His Shuriken is his primary form of waveclear. Stand just to the side of your minion wave so that he has to choose between hitting you, and pushing. Once he throws it, juke towards your minions so that if you do get hit, they take the brunt of the damage.
Abuse your range. When he walks up to last-hit a minion, attack him for it. Make him trade health for that gold. As a mage, you can shove out the lane pretty much whenever you want, but his cooldowns are very long. If you can force him to spend his cooldowns to push, he isn't hitting you with them, so you get more opportunities to attack him.
His W, the ability that makes the shadow clone, is on an incredibly long cooldown, but it's also where a huge part of his damage and all of his mobility comes from. If you see him use it, respect the shadow. He could teleport to it at any time, and it copies his abilities. Stay out of range of the slash, and keep an eye out for it to throw a shuriken. Once it disappears or he swaps to it, you now have a long window where he is very vulnerable. He won't have any mobility to juke your skillshots or escape if he pushes up, so his shadow clone is your signal to look to gain an advantage while he's weak. If he dumps his whole combo and whiffs, do not let him walk away from free. Punish him for it. He doesn't have mana, so you need to make him trade health for going in.
If Zed brings you down to half health, leave. Just leave. Go back to base, buy some items and potions, and come back at full health. He does increased damage to enemies below half, so if he gets you low, you will die to his next skill rotation. There is no shame in backing early when you're in a bad matchup. It's better to lose a wave than to give him kill gold.
If you play the lane right, Zed will get bored and try to leave lane to gank someone else and get gold. Don't let him do that for free. If he's moving towards the side of the map that your jungler is on, follow at a safe distance, and hope to either 2v1 him or make his jungle gank into a 2v2. If he's leaving to go roam top or bot, ping that he's missing, shove your lane into the tower so he misses gold/XP, and look to either roam to the other side of the map, back for a free buy, or place wards so you'll see him return.
Zed, like most assassins, will only scale into the late game with a mountain of gold. If you deny him that gold, he will be virtually useless in late game teamfights. If you are a mage, your job is not to beat him, it's to survive him. Outlast his aggression, take good trades, keep up the pressure without giving him anything, and eventually, you will do more damage than him from a range he can't deal with.
It's a tough matchup, don't get me wrong, but it's absolutely doable.