Use when an exact number or amount cannot easily be given or is unknown. How long will the meeting last? Well, how long is a piece of string?
Pro Tip 2/3
Non-literal Use
Understand it's a rhetorical question, not expecting a literal answer about string. How successful will the project be? That's like asking how long is a piece of string.
Pro Tip 3/3
Avoid Overuse
Use sparingly to avoid vagueness in situations where specifics are important. When budgeting, instead of asking 'How long is a piece of string?', seek exact figures.