Undead are generally evil because they're resurrected with evil energy and so they're evil because they're made of evil stuff. In the case of vampires in particular, they lose their memories and their pure thoughts are corrupted into darker ones. In a sense, undead follow similar rules to Celestials/Fiends/Outsiders where they're their alignment because they're made of stuff that matches that alignment.

However, it's worth mentioning that alignments also aren't necessarily set in stone. In the Forgotten Realms it's totally possible for an angel to fall and for a fiend to be redeemed. For example, Zariel was an angel that fell and became a fiend and was later redeemed during the Descent into Avernus adventure. There is definitely DnD material suggests that even creatures of always naturally evil alignments can have their alignments changed, although such occurrences are exceedingly rare and are considered outliers.

In the case of Astarian, he's 100% evil. He has a general lack of empathy towards people and is shown to like evil things. Out of all the current companions, him and Lae'zael are the only ones who have no problem with massacring the druid grove (Wyll leaves the party, Gale leaves unless a persuasion check is passed, and Shadowheart drinks herself into a stupor out of guilt). He can be sympathetic at times but he's still undoubtedly an evil person.

Shar worshippers don't necessarily have to be evil despite their deity being evil aligned. IIRC back in the 3.5 days, one of the rules for Clerics was that they had to be within one step of their deity's alignment, which in the case of Shar (who is neutral evil) means that they'd have to either be CE, NE, LE, or true Neutral. In Shadowheart's case I can totally see her as true neutral, leaning towards good. of course, none of this really matters that much since alignment has no mechanical implications in 5e and from a storytelling perspective there's totally situations where neutral characters on any end of the lawful-chaotic spectrum might follow a neutral evil deity. Similarly, deities probably don't care too much about the specific alignment of their followers (which is already a fairly vague way of measuring morality anyways) and instead care more about whether their worshippers follow their tenets.