Would advisors and universities generally support Ph.D. students who have an applicable thesis, to make contracts with the public sector in the US?
And, will it bring a good share for the student and advisor or mostly the university?
Academia Stack Exchange is a question and answer site for academics and those enrolled in higher education. It only takes a minute to sign up.Sign up to join this community
The answer really depends on the university you're in and the kind of agreement that you have. In most cases any intellectual property developed during your studies at an academic institution would entail signing off some rights to them. From my experience this is not a significant amount (less than 15%) but YMMV. You have to be aware that if you have any coauthors from other institutions this may complicate things - those coauthors have rights to the idea as well and that needs to be negotiated. Note that even coauthors that express no interest in joining your venture may have rights to some of the IP, and as a result to the potential profits. There are also funding agencies that may want a piece of the action (if you were supported by an industry grant for example).
In any case, your first step is to talk to your advisor/coauthors. Step two would be to contact the legal department of your university. They may ask that you remove any code you have made public (say on GitHub), and that you patent your work, a long and annoying process. I would not contact anyone about commercializing your software before a long discussion with the legal department.
This could get you in trouble, and most likely any company with a semi-competent legal team would not allow this anyway without you going through the proper channels.