Attaches 하다 straight onto a sentence ending in the formal-polite -습니다, quoting it as spoken: 알겠습니다 하고 "I said 'understood', and then", 자퇴를 하겠습니다 해서 "I said 'I'm withdrawing', so that was that". What gets quoted is usually one of the set formulas — 알겠습니다, 처음 뵙겠습니다, 수고하셨습니다 — which is why the pattern turns up in stories about formal moments. The textbook form is 라고 하다; dropping 라고 like this is how people actually talk.