Analogies are an interesting way of decorating your prose but they can become problematic if you are don't think about what they say.
An analogy is a similarity between the features of two things that will then enable comparison.
Some examples from high school students.
'When she tried to sing it sounded like a walrus giving birth to farm equipment'
'She was like a magnet: attractive from the back, repulsive from the front'
Both of those I enjoyed but then there are others that are not my cup of tea.
'The lamp just sat there like an inanimate object'
'Their love burned with the fiery intensity of a urinary tract infection'
Some are over-contrived and others plainly inappropriate, so the short answer is plan. Allow your imagination to stretch and apply what you are familiar with to appropriate situations using analogy as an illustrative tool. They don't need to be amusing but there must be a level of relevance.
If using analogy in an argument be aware that some people are taught that in debate attack your protagonists examples or analogies, in an attempt to discredit their position.
Fylingdales early warning system
It is painfully obvious that the US early warning system positioned on the North Yorkshire Moors in the 1960's, at the time of the Cold War, resembled golf balls. In fact they tended to be termed the golf balls on the moors, rather then there true identity. The analogy became the reality almost.
'The three receptors for identifying the threat of nuclear attack from Russia sat on the wind-blown moors like golf balls on a tee waiting to be struck to the east'
The above analogy, created off the top of my head, is at least picturesque. It is also relevant as I passed the site yesterday which looks very different today. (See below)
RAF Fylingdales 2015
The structure looks very different these days, has been given over to the RAF, and there are no longer any 'golf balls'. In some aspects the huge building resembles playing cards resting against each other.
Whale's jawbone - Whitby
'The twin arms of the jawbone framed Whitby Abbey like arms raised in prayer'
The visual is often inspiring to me when it comes to decorating prose. In using analogies, and this last one needs work, you have to be pretty sure of your facts and the visual similarities to ensure a successful illustration. However, it is useful to remember that readers enjoy illustrations, whether prosaic or pictorial.