When to go
You can capture this view of Tower Bridge and River Thames from The Shard during any month of the year. I recommend visiting in the summer months when it's warmer on the terrace.
This impressive viewpoint is best captured during blue hour. Once the sun dips, it creates a beautiful hue and with the mixture of the lights from the buildings turning on for the night and the natural light still holding on from the day, it creates the perfect conditions for dusk photography.
Field tips
Tripods (including very small ones) and other large equipment aren't allowed in The Shard and will be held by security until you leave.
The top floor is best for photos as you have less panes of glass to shoot through and less to worry about reflections.
From this far distance up above, I recommend using a long lens (65mm) to zoom in tightly onto the buildings.
To capture long exposures or low ISO photos, you'll need to rest your camera on the floor. I find it best to sit down on the carpet of the viewing deck and position your gear on the wooden board by the glass.
Window reflections can be a real pain up in The Shard, so make sure you're wearing dark clothing or have a dark jacket to mask out around your camera. A lens skirt that attaches to the glass can help a lot too, but the staff will occasionally tell you to not use it.