Without giving you simple platitudes, here is some advice;

First read and keep a copy of Rudyard Kipling's poem "If" always at hand - https://en.wikipedia.org/wiki/If%E2%80%94

Root Advice: Do not compare yourself to others constantly. This is the root of all evil. You should only focus on bettering your "present/future" self over your "past" self.

>I've failed,

If you have failed in some, you have succeeded in others. "Failure" is relative. Maybe you have had some major failures but that is no excuse to lose heart. You still have to soldier on and live the rest of your life without allowing a single event to define the future. If you live it positively you will make yourself lots more opportunities and make up for any past failures.

>I'm not as smart as I think

Actually, you are on a multi-dimensional "Smartness" scale where there is always some people much smarter and some people less smarter than you on any given dimension. You have to focus on your strengths i.e. where you are more towards the positive end of the scale and not obsess on the negative dimensions.

>I know I'm useless

Hey, HEy, HEY! DO NOT GO DOWN THIS LINE OF THINKING! SNAP OUT OF IT!

Unless and until you are biologically impaired, nobody is ever useless. They always can define a position for themselves in Society. Do not allow Society to define it for you but define it yourself to find some meaning for your life. That is enough.

PS: The ancient Hindu Text "Yoga Vasistha" opens with a strong emphasis on "Self-Effort" which is worth keeping in mind. Note that you don't have to believe in God/Religion/etc. to get the positive message. Here it is with some slight edits;

Sage Vasistha says: In this world whatever is gained is gained by self effort; where failure is encountered it is seen that there has been slackness of effort. This is obvious; but what is called fate is fictitious and is not seen.

Self-effort, Rama, is that mental, verbal and physical action ...

... When there is obstruction in the fruition of self-effort one should examine to see if there is [wrong] action, and if there is, it should be immediately corrected. There is no power greater than right action in the present. Hence, one should take recourse to self-effort, grinding one’s teeth, and one should overcome ... fate by present effort.

The lazy man is worse than a donkey. One should never yield to laziness ... seeing that life is ebbing away every moment.

One who says “Fate is directing me to do this” is brainless and the goddess of fortune abandons him. Hence by self-effort acquire ... and know that this self-effort leads to [results].

If this dreadful source of evil named laziness is not found on earth, who will ever be illiterate and poor? It is because of laziness that people live the life of animals, miserable and poverty stricken.

As is the effort so is the fruit, O Rama: this is the meaning of self-effort, and it is also known as fate (divine). When afflicted by suffering people cry “Alas, what tragedy” or “Alas, look at my fate”, both of which mean the same thing. What is called fate or divine will is nothing other than the action of the past. The present is infinitely more potent than the past. They indeed are fools who are satisfied with the fruits of their past effort (which they regard as divine will) and do not engage themselves in self-effort now.

If you see the present self-effort is sometimes thwarted by fate (or divine will), you should understand that the present self-effort is weak. A weak and dull-witted man sees the hand of providence when he is confronted by a strong and powerful adversary and succumbs to him.

Self effort is based on these three – knowledge ..., instructions ... and one’s own effort. Fate (or divine dispensation) does not enter here.

Fate or divine dispensation is merely a convention which has come to be regarded as truth by being repeatedly declared to be true. If this god or fate is truly the ordainer of everything in this world, of what meaning is any action at all?