I had this question when I started with LIs, and seen it asked many times:

If I'm levelling a Legendary Item for relics or shards, when should I deconstruct it?

The answer is: Level it to 60 (the max). If you are desperate to extract a legacy, you can stop at 31, but otherwise go to 60. It has been suggested 41 or 51 would also be good stopping places, but that's not true.

I have kept track of the LI decons I have done over the past few months, and it is apparent that levelling to 60 produces the best relics by far. Since I am able to craft level 85 3rd age LIs (hunter bows and melee weapons and bridles), most of my data is for those. Dropped level 85 LIs seem to have the same results as crafted, although I have fewer samples Lower level LIs give lower results, but the trend is similar.

Based on 98 decons, an average 3rd age LI levelled to 60 produced:
1.8 T7 relics
8.5 T6 relics, and
5.8 T5 relics, and refunded
894,423 IXP (84% of the 1,067,828 IXP to get to 60).

Since I don't normally level LIs to less than 60, for fun I did four to 41 and four to 51. It's a small sample, however.

Levelling to 41 produced on average
0.75 T5 relics (3 one time, none the rest) and
9.75 T4 relics, and refunded
381,025 IXP (55% of the 687,828 IXP to get to 41)

Levelling to 51 produced on average
6.25 T5 relics and
10.75 T4 relics, and refunded
795,625 IXP (89% of the 887,828 IXP to get to 51)

Note: IXP refunds are quantized to particular rune values. With so few samples, the average could be off by a lot. One of the 51s refunded 938,000 IXP, more than the LI had in it.

The difference between levelling to 51 and 60 is only 180,000 IXP. Since going to 60 always produced at least 1 T7 and many T6 relics, and stopping at 51 produced only T5 and T4 relics, levelling to 60 is a clear win.