This is one of my favorite personal finance questions! I have heard it asked time and time again but I always find the answers to be interesting. Maybe I'm a nerd, but I could literally read a blog post on the topic every day. I have a blog post in the works for my site, but before it's posted, I'll give you my take: I've developed a strong desire to pay off debt, so my natural inclination is to want to pay off my mortgage and be done with it. My wife brought around $80k in student loans to our marriage (paid off now) and I hate debt. On the other hand, I also try to make optimal financial decisions (emphasis on try).
I've gone back on forth on the question a number of times, but what put me in the "invest" instead of the "pay off mortgage early" camp is thinking about what would benefit my net worth the most in the long run. I came to the conclusion that since I have 25+ years until retirement, I like the odds of the stock market performing better than my 4.5% mortgage rate. I do hope to achieve financial independence earlier than that, but plan to keep working. Investing is a risk I'm willing to take, instead of locking in the guaranteed rate of 4.5% (I'm ignoring tax deductions for simplicity).
Anyone that does plan to pay off their mortgage early should calculate how long it will take to pay it off based on their extra payments. One of the crappy things about aggressively paying down your mortgage is your minimum monthly payment doesn't change until it is completely paid off. The longer it will take you to pay off, the higher the risk of an unexpected life event derailing you off your plan.
How much do you value liquidity? Let's say person A has $275,000 in investments and a $250,000 mortgage. Person B has $25,000 and no mortgage. Their houses have the same value. Which person would you rather be? This isn't a trick question. Both have the same net worth, it's just structured differently.
Whatever you decide, realize, either way, you are making a great decision. You are in a tremendous position to be deciding between these two options. Until my mortgage is paid off I'll always have to fight the urge to pay it off more aggressively, but I plan on sticking to my investing plan.
Hopefully this helps.