I noticed that in some anime (specifically, the Ace Attorney anime), the characters often switch between 何だと, 何ですと, and a few other slight variants. What is the difference between them?
何だと is a plain form while 何ですと is a polite form.
Who said 何ですと?
何だと is a more common form, and it's used mainly in fiction by many male speakers and "strong" female speakers. It usually sounds more or less accusatory.
何ですと is rarer, and it is virtually nonexistent in real-world conversations. 何ですと is used to show one's surprise (i.e., it's not accusatory), and it is mainly used by a sycophantic character who tends to feign politeness. In Ace Attorney, 亜内 (Winston Payne) is the typical character who may well use 何ですと. You may also see other speakers say 何ですと jokingly/comically. If 成歩堂 (Phoenix Wright) said 何ですと, it sounds comical.