Because language models respond to the text you give them, small changes in wording can produce very different results. Prompt engineering is simply the practice of writing that input deliberately: giving context, specifying format, and being explicit about what "good" looks like, instead of hoping the model guesses correctly.
A few habits go a long way. State the role or audience ("explain this to a beginner"), give an example of the output style you want, and break complex requests into smaller steps rather than one giant ask. Asking the model to think through a problem step by step before giving a final answer also tends to improve accuracy on anything involving reasoning or math.
It's also worth iterating. Treat the first response as a draft: point out what's wrong or missing, and ask for a revision rather than starting over. Good prompting is less like casting a magic spell and more like briefing a very fast, very literal-minded assistant.