Despite and in spite of mean exactly the same, but despite is more common than in spite of.
Despite and in spite of are prepositions. Both expressions can be followed by a noun or noun-equivalent.
I enjoyed the movie despite having a headache.
OR I enjoyed the movie in spite of having a headache.
Both expressions are used for saying that something happens although something else might have prevented it.
The government went ahead with its decision to build the nuclear power station despite / in spite of widespread opposition.
Despite the fact that / in spite of the fact that
Despite and in spite of cannot be directly followed by a that-clause. Before a that-clause, we use the expression the fact.
He still loves her despite the fact that she cheated on him.
OR He still loves her in spite of the fact that she cheated on him.
Many people are successful despite the fact that they do not have a university degree. (NOT Many people are successful
despite that they do not have a university degree.)
To do something despite yourself is to do it even though you didn’t intend to.
The boy found the money on the table and took it despite himself. (The boy had no intention to take the money; he took it, nonetheless.)
Never use of after despite. Always use of after in spite.
We enjoyed the evening despite the bad weather.
OR We enjoyed the evening in spite of the bad weather.
She always looks cheerful in spite of / despite her problems.
The same ideas can be expressed using though and although.
We enjoyed the evening though / although the weather was bad.
She always looks cheerful though / although she has many problems.
Note that though and although are conjunctions. They should be followed by a clause.