The trill or any ornamentation is optional but seems like it is usually there. I am familiar with this melody more generally as part of an authentic cadence, but this particular rhythm seems very common in some types of music and I am having trouble figuring out if there is a name for this and from which piece it might be most widely recognized for an average person.
It is notated in one of three ways (note that baroque composers felt that the use of tr was not always necessary):
Appoggiaturas are used when the composer wants to specify the length of starting and ending notes. If the first upper tone is shorter, there is no need to write a preceding note since trills in the baroque period always start on the upper tone unless specified.
In your case, you would add an appoggiatura since the first upper tone is held for a nontrivial time such as a quarter note. The trill in this case is called an enclosed trill:
Another post with no clef, key signature, or accompaniment (but the cropped bar lines suggest a lower clef.) I'll assume
C major, treble clef, and ending on a root position
I would say there are two levels of embellishment, the marked trill on
TI, and the neighbor motion of
B4 A4 B4. If you remove both levels of embellishment, the essence of the line is
DO TI DO.
I don't know of a specific, well known name for that melodic movement in a cadence, other than to say it's the soprano part for a perfect authentic cadence, I would call it a neighbor or auxiliary motion to describe the melodic line. The way that neighbor motion is achieve through a subdividing of beats can also be generically referred to as diminution.