I submitted my manuscript to two journals online (not at the same time). During the process of submissions I was asked to determine the editor and I selected the same editor in both journals. Need to say, the editor whom I selected is a specialist in my field word (mathematics). Unfortunately, in both journals, my manuscript was rejected. In the first journal, I received no report about rejection, that is why I submitted to the second one. The second journal rejected my article with a report on the technical reason of rejection including some reasoning. Now I have already tried to solve the errors and prepared a new version of that. I would like to try to submit it again to another journal again with the same editor of previous journals. Does it have a bad effect if I submit again for this editor? Can I send an email to potential editor to ask his opinion on my new version of manuscript, then I submit it formally to the journal who is its editor? I am asking this because I suppose he probably has a presence of his mind about my manuscript and it helps me to speed out the publication of paper.
Unfortunately this depends somewhat on personalities so a definite answer is impossible. But if your communication with the editor has been helpful/cordial then it might not entail much risk, contacting that editor.
But since you already have two rejections where the person was involved, you might want to try for a fresh look at your paper with a different editor. This is especially the case since you weren't encouraged to resubmit with revisions.
You might also try contacting that editor without sending the paper and just give the title and state that you have revised the paper with advice from the reviewer and ask for any advice they might be willing to give. Perhaps they ask to see the paper. Or not.
I don’t see the benefit of trying a third journal with the same editor. This person already rejected your paper twice, that suggests they do not think highly of it. There are plenty of math journals, I strongly suggest finding one with a new editor who will look at your paper with fresh eyes.
As for a pre-submission email, that would be going outside the normal process, and the normal process exists precisely so that all authors have a uniform, consistent process to have their papers evaluated. It’s frustrating to get repeated rejections and to deal with automated submission workflows, but this is how the system is set up - for everyone - and there are no shortcuts. In very exceptional cases I’d say it’s acceptable to ask for an editor’s informal opinion, but your situation doesn’t sound like one of them.
In any case, good luck!