What can you do with public domain software? Anything you want. In particular, you can change it to suit your needs and use, publish, or sell it.
All works subject to copyright protection, including software, include both copyrightable and non-copyrightable elements. The non-copyrightable elements are in the public domain. They include ideas, procedures, processes, and systems, methods of operation, concepts, principles, and discoveries.
In the world of software, this means that computer languages (like the English language) probably are in the public domain. While the English language is not protected, a poem written in English has elements which are protected. Similarly, a program written in G++ has protectable elements. Ideas for systems, such as the idea for a spreadsheet, are public domain, while a particular spreadsheet program may have protectable elements. Elements required by efficiency, such as using the space bar to move a cursor, are in the public domain. Elements required by external factors, such as for compatibility of other programs, or requirements of computer hardware, are in the public domain. Standard programming techniques, such as overlapping windows and menus, are also public domain, as are purely functional elements, such as the ability to move a window and create a new folder in an old folder.
Copyright rights accompany creation of the software. The creator or owner can dedicate his or her rights to the public with a statement in the published program, generally on an initial screen or readme or FAQ file. Such dedicated programs are free and in the public domain. Many programmers share a philosophical belief that programs should be free and dedicate their programs to the public.
Another source of free software is for the copyright owner to "license" the public to free use for limited purposes. The user typically is prevented from selling or changing the software without permission of the owner.
Normally modifying software (creating a derivative work) requires permission of the copyright owner. Copyright rights in the modifications are owned by the creator of the modifications. In open source software, for example, much of the UNIX system and LINUX programs, the programs can be freely used and modified provided the user does not prevent others from similarly using and modifying the modifications.
The easiest way to find software dedicated to the public domain and free and open source software is on the internet. But be warned - just because the person posting the software states it is in the public domain doesn't make it so. You should look carefully for indication of the name of the creator or owner and confirm that it is available. It's your responsibility to make sure it's O.K. before using someone else's program.
Some software has entered the public domain by expiration of its copyright. Everything published in the U.S. before 1923 is public domain, although this doesn't help with software. Software published before 1964 whose copyright was not renewed in the 28th year after publication has entered the public domain. The only way one can learn if the copyright was renewed is to look at the records in the Copyright Office at the Library of Congress. Fortunately this is convenient for those of us who live in Maryland. See www.loc.gov.
Since the initial 28 year term of copyright for material published between 1923 and 1964 did not require registration, it is impossible to know what portion of such works were renewed, although the Library of Congress estimates that less than 15% of such were renewed. Some software is included in these pre-1964 works, but the expiration of copyright is most important for books, films, and music.
Also, software published in the U.S. before March 1, 1989 without a valid copyright notice probably is in the public domain. This requirement does not apply to works published later, and there are many exceptions to this rule.
Finally, there is an enormous amount of software which has been and still is being created by employees of the U.S. government and some outside contractors to the U.S. government. These works are in the public domain. Some are classified or otherwise restricted, but most are freely available.
There are a few other concerns once you have found public domain software. It is possible that the ideas in the software are protected by patents. You must avoid the use of trademarks belonging to others in a way likely to cause confusion as to the origin of the product or service. Some programs may contain trade secrets, but these must be protected by the owner and would be unavailable to you without misbehavior on your part. Commercial use of a person's name or image may violate state right of publicity laws.
In general, however, you will find that searching for public domain software is well worth the effort. Good luck.