Relationship queries helps you extract data from Salesforce database with minimum possible number of queries. Let me give you simple examples of all kinds of relationship queries you can write.
Basic Child to Parent
Select Id, Name, Account.Name From Contact
Account is the name of relationship thats defined by AccountId lookup field on contact object.
Expanded Child to Parent
Select Id, Name, Account.Parent.Name From Contact
This will retrieve the name of the parent account of the account associated with the contact
Basic Parent to Child
Select Id, Name (Select Name From Contacts) From Account
You know what this will return.
Combined Child to Parent and Parent to Child
Select Id, Name, Account.Name (Select Quantity, UnitPrice, TotalPrice, PricebookEntry.Name, PricebookEntry.Product2.Family From OpportunityLineItems) From Opportunity