The simplex algorithm is used to solve linear programming problems by iteratively moving from one basic feasible solution (BFS) to another with a better objective value. It starts at an initial BFS and checks if it is optimal. If not, it moves to a new improved BFS and repeats the process until an optimal solution is found. For the example problem of maximizing profit from two drugs given machine time constraints, the algorithm starts at BFS (0,0,9,8) and improves to BFS (4,0,5,0) by increasing the variable with the largest coefficient in the objective function while maintaining feasibility.