A friend asked me the other day for some pointers regarding stretching for tennis, so I might as well publish what I sent him. Disclaimer that I'm not a physio - the below are exercises that have worked well for me over the last decades, maybe some of them work for you as well!
First and foremost, cold-stretching before play probably does more harm than good, so first I usually do some light off-court warm-up, then some dynamic stretching, and after the hit some static stretching for recovery, injury prevention, and flexibility.
The basic warmup
I first like to do some light jogging or cycling, then go "through the motions". That involves jogging backwards, heel tappings, knee lifts, sidesteps, crossovers, shoulder / arm rolls, self-hugs (alternating the top-arm), maybe some careful upper body rotations (standing twists?), and shaking out arms and wrists, and bending the fingers (e.g. making and releasing a fist). I also like taking 2 racquets and swinging through the main swings. You could also put a weight on one racquet.
That's the warm-up-the-body-part, maybe 5 easy minutes if you don't rush it. That can already get the body ready for a mid-intensity hit. If you feel ready to get started, you can then adjust the warm-up hitting on court to your light pre-hit regime, e.g. by starting more slowly and consciously adding motions that you haven't warmed up - maybe take a few bigger last steps towards the ball or gently exaggerate your upper body rotation.
If you want to prep better and also want to do your body some good, and/or your on-court endeavor is about to get intense quickly (e.g. matchplay after those allotted 5 minutes of warmup hitting), it's probably a good idea to also add some...
Dynamic stretching
For dynamic stretching (after warmup and before the hit), the most important exercises are probably lunges, knee hugs, Frankensteins (straight leg up, carefully), mobilizing the hip, and gently pre-stretching shoulders as well as forearms and wrists. A deep squat has become my favorite stretch to create some mobility and breathing room for the lower back - that one stretches a bunch of stuff at the same time, e.g. the glutes.
If you worry about your heels (e.g. if that's your weak spot, and/or you're over 30, and/or you play on hard court etc), you can do a few slow heel lifts and stretches, on a step or similar. For those, I found that there's a thin line between warming up and 1) strength-building (takes away energy and tightens calf muscle / increases pull on the tendon), and 2) deep stretching (relaxes and thus tires muscle). You'll get a feel for it - maybe try 5 on each side first. Another option could be going into a downward facing dog pose, and alternately pushing your heels backwards - that actually feels quite good after a few reps. Good to do at home too...
Serious folks also like to do resistance tube stuff for the upper body. If you measure resistance and reps right, you'll get a bit of a workout without tiring your muscles too much - so that's some toning and more importantly stability you can feel. Might be fun to have one tube to grab onto in the house? I like the orange-level resistance, burgundy might be good for warm-up too. And you can always adjust the level (i.e. length) of pull.
Update: here's a fitting video that the USTA came out with at the beginning of 2018:
After the hit is before the hit
Afterwards, you have the opportunity to speed up recovery and increase flexibility, thus also prevent injury and improve performance for next time. Plus you're already out there and warmed up, so might as well make use of that flowing energy...
You can do some static stretches, maybe as you chat or grab a drink so that the whole program doesn't feel too heavy. If you've been exposed to hard court impact, the lower body might be a tad more important, especially calves / heels, maybe also glutes.
For the calves, you can step onto something elevated and carefully let the heels drop and stay there for 5 breaths or so. Then repeat once or twice.
For glutes, holding that deep squat I mentioned earlier feels good to me (make sure the knees are positioned comfortably), or doing some variation of the pigeon stretch.
I usually go through a whole top-to-bottom or bottom-to-top routine, sometimes in the shower. You can probably first pick a few stretches for whatever tends to get tight and go from there...
To soften tight muscles, electrolytes and that massage stick I have been using come to mind.
Closing thoughts and some more visuals
Over the last decade or so, I've started to see this kind of work more of an opportunity to maintain, improve, and future proof the body, so it's great when it's anchored on a fun activity and some social interaction!
Here are some videos I found, for inspiration:
Novak (very advanced and a lot of static stretching in there, so you probably don't need / want to do the whole thing before playing!)
Maria (gets into those heavy medicine ball stuff pretty quickly)
Some good dynamic stretches, for me warming up only with those would probably not get the blood flowing / sweat going enough - you can skip around to get a visual for some of the exercises I've mentioned above. Exercises start at 1:06: