The cadenza is a more or less virtuoso passage performed near the end of a concerto movement or aria, usually improvised by the performer, sometimes written out.
The composer, who was always also a performers (like Corelli, Vivaldi, Bach, Beethoven, Mozart, Paganini and many more), used to leave the soloist (himself) some space for the free improvisation after playing within a group, to show even more of his personality and technical and musical abilities.
Therefore, at the end of one or more movements, before the main theme comes back again, they used to write only one long note and often the indication Cadenza.
Some composers later wrote cadenzas for other famous composers' works (for example, Beethoven for Mozart's piano concertos). This tradition continued until the beginning of the 20th century and therefore for most of concertos we don't have original cadenzas written by the concertos composers.
An important exception is in Mozart's Sinfonia Concertante for violin, viola and orchestra. Perhaps it would have been a bit more difficult for two soloists to improvise together, (although they used to be very skilful in these things at that time, a bit like jazz players now), or for whatever other reason, anyway Mozart wrote not one, but two cadenzas for his Sinfonia Concertante: one for the first and one for the second movement.
They are interesting because they give us a hint on how Wolfgang himself might have played a cadenza. Watch this video with the first movement cadenza played by myself on the viola.
In the 20th century performers most often used to play cadenzas written by previous virtuoso players-performers, but more recently some have started again to play their own ones.
Unfortunately, we cannot know how, for example, Paganini played his own cadenzas, although he was famous for his improvisations and unusual effects.
However, in this video you can see to what extent a performer can get in his own improvisations, if he wishes. After all, that was the intention. It is played on the violin by Gilles Apap for the third movement of Mozart's 3rd violin concerto in G major.
He's clearly having fun with it, I wish you to enjoy it.
Of course, there have been different, very contrasting reactions to this performance and I'm sure you'll have your own opinion...
In case you wonder how the cadenza relates to the not so rare viola concertos, luckily, there are several cadenzas that have been composed for them. There is even a cadenza that is a composition with its own life, not connected to any other work. See here a list of them with links for those who'd like to buy and perform them.
Here's my favourite book of cadenzas to viola concertos, by Maestro Michael Kugel. You'll find cadenzas for J. C. Bach, Hoffmeister, Stamitz, Khandoshkin, Pleyel, Rolla, Paganini concertos.