In about a decade of working as a full-stack software developer, I've found that through experience I'm easily able to predict well ahead how things could possibly "go wrong". Most of the time I can solve this myself, I am lacking some information which is then given, or even people think it is a great remark and are thankful I thought about it. Other times however I need someone on a level above me to take action to address this, or I am not being heard and dismissed.
An example would be that mid-project, a change of technology is suggested, which is considered to take only a little time as most things should be able to be re-used, but I know from experience that this will take longer. So I express this as a concern to the team and to the manager, sometimes even quoting I've been through this before at another project, but it gets waved away. Eventually, it happens that it takes about as long and it is pretty frustrating because not only do I have to watch it going as I said it would, I also somehow end up getting told I'm at fault because I didn't believe in the changes or I couldn't have predicted all of this.
Now since I work as a consultant, I've learned to give advice once and then drop it if it isn't being heard and try to do what I can to help things along, and maybe cover myself by having things in writing. If the client wants to ignore my advice, and I have documented that the advice had been given, and they gave me on paper that they want it the way they ask, then that's basically a costly mistake on their part.
People, however, get upset when they notice they have made expensive mistakes and generally don't take the higher road of admitting fault. Maybe that is just something I'll need to learn to live with, consultants are an easy scapegoat, you just claim they did a poor job and replace them. So document and don't take it personally.
However, I am wondering if there are ways or techniques in which one could express themselves, when very sure of a case, to make it so that you are taken seriously. I don't want to resort to anything underhanded, so no psychology tricks. What I've tried is telling the story of a previous case, finding and listing a few challenges which will need answers to try and clarify not all angles are covered, sharing documentation on best practices and why they are that, or at worst I've had to remind that I actually have worked with something for X years because sometimes people seem to forget your qualifications. I feel though after doing this repeatedly, you generally become that whiner and it is even worse to get anything through.
So in short, how can I be taken more seriously in my advice so that bad things don't have to happen and I don't become wildly unpopular?