Turn off lights and open windows to give the hummingbird an escape route. You can place a small branch near it and hang a string to an open window as a guide. Do not touch the bird, move slowly, and offer a sugar water solution near the window. Wait patiently, and if it does not leave after several hours, contact a wildlife rehabilitator.