if it's a page limit, I usually take it as a suggestion and write 3-5 pages beyond that (unless the professor explicitly states that he wants it to be x number of pages. I had one professor who would only let us write 1 page essays. probably one of the hardest things I ever had to do in college... it's hard to come up with a well thought out, insightful, A-material essay with only 1 page. usually, 1 page = just my introduction).
for word limits, I make an outline based on the maximum space I have, write the essay without thinking about the word limits, and then go back and trim / fill if necessary.