if (sensorValue <= 170){
}
if ((sensorValue > 171) && (sensorValue <= 342)){
}
if ((sensorValue > 342) && (sensorValue <= 513)){
would make more sense (to me) as:
if (sensorValue <= 170)
{
}
else if (sensorValue <= 342)
{
}
else if (sensorValue <= 513)
{
If the value is 30, that is less than 170, so the first block is true and the rest of the if statements are NOT evaluated.
If the value is 300, that is not less than 170, so the next statement is evaluated. The value is less than 342, so the block of code is executed, and the rest of the if statements are not evaluated.
Is it true that when I use and if statement that I do not really need the else statement?
Yes. The thing is sometimes you don't want a bunch of it statements being evaluated unnecessarily. Suppose, for instance, you wanted to turn on one of 4 LEDs depending on the temperature obtained from a sensor. You could do:
int temp = GetTemp();
if(temp < 30)
{}
else if(temp < 40)
{}
else if(temp < 50)
{}
else
{}
Or, you could have:
if(GetTemp() < 30)
{}
else if(GetTemp() < 40)
{}
else if(GetTemp() < 50)
{}
else
{}
Now, the second code looks cleaner, since there is no wasted temporary variable. But, suppose that the temperature sensor takes 1 second to produce a result. The first example calls the function once. The second calls it 3 times, which means that it could be much slower. Now, imagine what would happen in your code structure with 6 compound if statements, if GetTemp() was called 11 times - 10 of which were unnecessary.
Which Arduino are you using? On the 328-based Arduinos, not all the pins you are using are capable of PWM.