The math matters... somewhat.
I personally don't usually spend a lot of effort on optimization. I can do it, but it isn't actually all that much fun, for me, to sit alone playing with numbers and reading threads on optimization to learn new tricks that others have found. On the other hand, I don't run contrary to the basic ethos of a game, either - if I know there's going to be a lot of combat, I don't make a character who is a pacifist, or absolutely inept in combat situations.
I'll give an example from a Star Wars Saga Edition game I played in a little while ago. The premise was that all characters would be young Jedi. One player decided to eschew Force use, and go all Mandalorian combat monster. Two others went with standard Jedi combat builds. One player went the social skill route with lots of force powers - basically a Jedi Sorceress.
Then there was me. I looked at that spread. We had four characters who were really hot in combat. And one who could also handle our social interactions. But none of them... were terribly bright. They had the high strength, con, dex, and charisma. But there wasn't an intelligence or Wisdom above 12 among them.
So, I used my Charisma and Strength as (relative) dump stats. I took a decent Con so I'd have hit points to spare, and then went strongly for Int/Wis skills. I was the Smart Guy (and the one with the spaceship). Not mechanically optimized at all. I was many levels before I got a Force Power I could use well enough to be really effective in combat next to the bruisers. But, whenever there was something that needed to be done in a fight *other* than killing the bad guys, I was the go-to for it. And I wound up in the party leadership role, because I was always the one with the best plan.
So, mechanical optimization's not required. But some basic effectiveness, and a role in the party *is* kind of required. And, edge cases of rogues who screw up being able to make sneak attacks, d20 variants are usually pretty good at guiding you to that basic effectiveness. Pick a class, and go with it, and you'll basically be okay.
Now, I also think that the player actively trying to pick a character so flawed that it is doomed to fail is a bit of a boogeyman. Very few players are out there to actively run against the system so hard that they wane into uselessness. However, if the GM is allowing Optimized characters next to the un-optimized, it takes some careful thought as to how you are gong to run your adventures to make them fit together. You can't just toss them both into a dungeon crawl and expect good results.
So, you should pick your character with your party and game system in mind, and the GM should (IMHO) run the game with the player's intentions in mind, and everything will usually work out fun.