[verb (plain form)] + と聞いた/と聞きました [i-adj (plain form)] + と聞いた/と聞きました [na-adj (plain form: ~だ)] + と聞いた/と聞きました [noun + だ] + と聞いた/と聞きました
[sentence (plain form)] + と聞いた/と聞きました
The structure と聞いた is used to report something that the speaker heard from someone else or from some source. It combines the quotation particle と with the past tense of きく聞く (to hear), literally meaning "I heard that…"
The clause before と should be in plain form (casual form), regardless of whether the overall sentence is polite or casual.
The verb きく聞く itself can be conjugated to match the politeness level of the sentence:
Casual: と聞いた
Polite: と聞きました
You can indicate who you heard the information from by using ~から or ~に.
The clause before と follows normal plain form rules, including negative and past forms:
と聞いた is similar to そうだ (hearsay) in that both convey secondhand information. However, と聞いた explicitly states that the speaker heard it, while そうだ is more general ("I hear that…" / "they say that…").