That is a word which can be used in many different ways. It is a very good example of a word that shifts its word class with ease.
- That can be a demonstrative, for example in the sentence "I like that cake". Here it is opposed to this. Both words can be adjectival, as here with the noun cake, or pronominal as in "Do you like that?"
- It can be a relative pronoun, for example, "I ate the cake that I baked yesterday". Here it is a substitute for which. This usage joins a relative clause to the noun it describes.
- It can be a conjunction, for example, "It cannot be denied that the cake was delicious". Here it links various kinds of subordinate clauses, mostly noun clauses, to a main clause.
It's a good idea to use the conjunction 'that' more in academic writing than most of us do in speech - particularly after such verbs of utterance as 'to say', 'to report', 'to think' etc. It can help to make your writing much clearer.
Some confusions that arise over that: