This is easy, there's a short:
battery, battery terminals, starter/ground cable, starter connections.
time for basic multimeter tests from battery, terminals, clamps, grounds, starter.
check wiring of any related parts you've previously replaced - starter and any other related components recently worked on. a cursory search shows you replaced the ignition switch or something - check connections/fasteners there.
as stated - the click-click-click and CEL are not related.
CEL's are often artifacts of another issue rather than indicating any fault with that component. your cause and effect is backwards. the CEL isn't causing the starter issue - the starter issue is causing the CEL. The short, or current draw of the starter, may dirty up the sensor signals. or the abrupt "movements" of the starter are confusing the ECU.
if you have your original starter i'd keep it and replace the contacts. aftermarket replacement starters fail all the time, a friends new Advance Auto starter failed within a month or two last year. happens all the time. you might get lucky, but the failure rates are much higher than OEM.