If for some reason you cannot use your iPhone's physical power button, then you might be wondering how to do it inside the iOS operating system. Maybe you'll think that Siri can do it, but unfortunately officially Siri can't turn your iPhone off for you (at least not yet).
An alternative way to turn off your iPhone (or iPad or any iOS device) is to use the assistive touch and press and hold the "Lock Screen" accessibility button.
If you haven't turned on your Accessibility setting, you can do so by going to Settings > General > Accessbility > Assistive Touch and sliding the switch button to "On".
You can now turn off your iPhone by clicking the assistive touch button and going to "Device" then pressing and holding the "Lock Screen" accessibility button.