You add content that is keyword rich and niche focused.
Get the keywords on your pages right, put them in those oh-so crucial spots in your content and you'll get ads relevant to your content
But sometimes this can be so unpredictable.
While browsing today I came across a blog on niche marketing. The content was not great but it was okay as niche marketing blogs go. You could tell it was a newbie blog with rehashed content but we won't hold this against him or her
Anyway the website name was business something or the other. But all the google ads displayed were on the keyword 'bus'
Why am I telling you this? Because a closer look at the pages shows where he went wrong
Adsense really can be unpredictable when you blindly follow what people tell you without testing things out for yourself.
Keyword stuffing and trying to tell the code what ads to display on your pages is all well and good [actually it's not and doesn't work]. But if you right naturally on the topic you wish to communicate to your readers, the relevant keywords will appear naturally in your content and the adsense code will have no difficulty displaying ads that are relevant to your content
And having said that I'll probably get adsense ads on this post that are totally out of sync with the words on this page
Never mind, the lesson is still valid :)