Profiling Code

How do people profile and optimise their code?

Any best practices?