How can you find out if your iPhone ever got wet? I know that iPhone has some internal sensors that can be used to test if the device was got ever wet. 

Apple uses them in order to deny your warranty.

The question is how to find out this before sending your device to service?
Those sensors are no electrical sensors, but pieces of paper that change from white to red when they get wet. There are up to two spots you can look at without opening the device. Have a look inside your headphone jacket and your dock connector. (use a torch/flashlight as lint or dim light can make these orangish-pink indicators hard to discern!)

Have a look at this page.

Here's the diagram for an iPhone 4/4S: