How can I fit a board to another that isn't straight?
The technique I've used most often is called "scribing". The word simply means "writing" or "tracing", but here's how it goes. 


Set your board to be fitted in place. I typically tilt it so that I have roughly the same gap at each end if the high spot is in the middle. Otherwise, align the top as you'd like it to ultimately be. 
Lay a pencil on the surface you're fitting to at the location with the widest gap and perpendicular to the board being fitted. Either tilt the pencil up so the lead point meets the corner of the board or lay something under the pencil to raise it, as needed. You want the point of the pencil exactly at the edge of the board being fitted at the widest part of the gap.
Slide the pencil (and spacer, if present) along the surface being fitted to, scribing a line parallel to it on the board being fitted. If done correctly, you'll see an exact replica of the shape to be cut drawn on the board. 
Use any technique needed to shape the board to the scribed line. A powered hand planer is useful, or a belt sander, or a circular saw with a steady hand, or a combination of these. If done carefully you should have a very good fit. If needed, repeat the process. 


Now that I've written that all up, I recommend this article for a better description and diagrams. Here's a good video, too.