Simulation studies are a powerful tool in epidemiology and biostatistics, but they can be hard to conduct successfully. Sometimes unexpected results are obtained. We offer advice on how to check a simulation study when this occurs, and how to design and conduct the study to give results that are easier to check. Simulation studies should be designed to include some settings where answers are already known. They should be coded sequentially, with data generating mechanisms checked before simulated data are analysed. Results should be explored carefully, with scatterplots of standard error estimates against point estimates a powerful tool. Failed estimation and outlying estimates should be identified and avoided by changing data generating mechanisms or coding realistic hybrid analysis procedures. Finally, surprising results should be investigated by methods including considering whether sources of variation are correctly included. Following our advice may help to prevent errors and to improve the quality of published simulation studies.