This question can actually be rephrased as "How do you find inspiration to compose your piece" since developing themes and motives is a creative process. There isn't a general rule for coming up with these because it is pretty subjective.
Here's what I can share with you: it is important that the themes or motives be formed naturally in your mind, and don't dwell on them and force ideas to come. Good ideas don't come in this manner.
Creative ideas are often formed when you engage in certain activities, such as taking showers, exercising, and meditating. Your mind is relaxed when you perform these activities, and inspiration usually sparks this way. This is according to my experience.
Good ideas are sometimes formed when you dream, and this works for me most of the time. Practising lucid dreaming is key to acquiring ideas for your composition, and these ideas are usually better than the ones you come up with when you are awake.
Improvisation is another method. If you just can't come up with good themes or motives, go and pick up your instrument and start playing whatever comes to your mind. Try out different possibilities and hear which one sounds the best to your ear.
That is how I find inspiration for my compositions; however, other composers may have different ways of doing this. I hope this helps.
Carl Koh Wei Hao