Whenever I do this, I make the following changes:
- rename the main directory (/mod/oldname => /mod/newname)
- rename the language file (/mod/newname/lang/en/oldname.php => /mod/newname/lang/en/newname.php)
- search and replace all references to the original name throughout the code (preserving the original case, to make the comments read a bit better). This step can be more difficult if the module name is also used in other contexts, e.g. with the 'URL' module, you need to be careful to not rename all 'moodle_url' references.
- Tweak the version.php file to reference today's date (optional).
Step 3 should manage to fix the names of the database tables, plus all references to them.
Theoretically, you might be able to get away without renaming some of the functions. However, most functions in /mod/newname/lib.php must match the name of the module, otherwise Moodle won't be able to find the function it needs to call. Also, you should assume that (at the very least) the lib.php, version.php and settings.php files for all modules will sometimes be in memory at the same time, so any functions with the same names in those files will cause problems.
In practice, this means that using your IDE's 'search and replace in multiple files' function is the best way to proceed.