For more serious problems, when shutting it off doesn't work, you can do a soft reset. Hold down the power and home key for about 10 seconds, or until the Apple logo appears. Let go and wait for it to reboot. This will take a few minutes, so be patient.